nghttpx: Delete DownstreamConnection from Downstream explicitly
This commit is contained in:
parent
20e63151a5
commit
fc062976a1
|
@ -162,6 +162,10 @@ Downstream::~Downstream() {
|
|||
ev_timer_stop(loop, &downstream_wtimer_);
|
||||
}
|
||||
|
||||
// DownstreamConnection may refer to this object. Delete it now
|
||||
// explicitly.
|
||||
dconn_.reset();
|
||||
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
DLOG(INFO, this) << "Deleted";
|
||||
}
|
||||
|
@ -191,8 +195,6 @@ void Downstream::detach_downstream_connection() {
|
|||
std::unique_ptr<DownstreamConnection>(dconn_.release()));
|
||||
}
|
||||
|
||||
void Downstream::release_downstream_connection() { dconn_.release(); }
|
||||
|
||||
DownstreamConnection *Downstream::get_downstream_connection() {
|
||||
return dconn_.get();
|
||||
}
|
||||
|
|
|
@ -69,8 +69,6 @@ public:
|
|||
|
||||
int attach_downstream_connection(std::unique_ptr<DownstreamConnection> dconn);
|
||||
void detach_downstream_connection();
|
||||
// Releases dconn_, without freeing it.
|
||||
void release_downstream_connection();
|
||||
DownstreamConnection *get_downstream_connection();
|
||||
// Returns dconn_ and nullifies dconn_.
|
||||
std::unique_ptr<DownstreamConnection> pop_downstream_connection();
|
||||
|
|
|
@ -86,11 +86,7 @@ Http2DownstreamConnection::~Http2DownstreamConnection() {
|
|||
}
|
||||
}
|
||||
http2session_->remove_downstream_connection(this);
|
||||
// Downstream and DownstreamConnection may be deleted
|
||||
// asynchronously.
|
||||
if (downstream_) {
|
||||
downstream_->release_downstream_connection();
|
||||
}
|
||||
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
DCLOG(INFO, this) << "Deleted";
|
||||
}
|
||||
|
|
|
@ -118,13 +118,7 @@ HttpDownstreamConnection::HttpDownstreamConnection(
|
|||
ioctrl_(&conn_.rlimit), response_htp_{0}, group_(group), addr_idx_(0),
|
||||
connected_(false) {}
|
||||
|
||||
HttpDownstreamConnection::~HttpDownstreamConnection() {
|
||||
// Downstream and DownstreamConnection may be deleted
|
||||
// asynchronously.
|
||||
if (downstream_) {
|
||||
downstream_->release_downstream_connection();
|
||||
}
|
||||
}
|
||||
HttpDownstreamConnection::~HttpDownstreamConnection() {}
|
||||
|
||||
int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
|
|
Loading…
Reference in New Issue