-
Notifications
You must be signed in to change notification settings - Fork 950
Closed
Labels
Description
void Service::Stop() {
LOG_TRACE << "this=" << this << " http service is stopping";
assert(listen_loop_->IsInLoopThread());
if (evhttp_) {
evhttp_free(evhttp_);
evhttp_ = nullptr;
evhttp_bound_socket_ = nullptr;
}
listen_loop_ = nullptr;
callbacks_.clear();
default_callback_ = HTTPRequestCallback();
LOG_TRACE << "this=" << this << " http service stopped";
}
void Service::SendReply(struct evhttp_request* req, const std::string& response_data) {
...
if (listen_loop_->IsRunning()) {
LOG_INFO << "this=" << this << " dispatch this SendReply to listening thread";
listen_loop_->RunInLoop(f);
} else {
LOG_WARN << "this=" << this << " listening thread is going to stop. we discards this request.";
// TODO do we need do some resource recycling about the evhttp_request?
}
}The above code, Service::SendReply in work thread will use listen_loop_ at the time that this object listen_loop_ is be set to nullptr in Service::Stop()
Reactions are currently unavailable