Delete downstream if SPDY stream has been already closed
This commit is contained in:
parent
e8cefa9238
commit
67669bf3ca
|
@ -272,18 +272,17 @@ void spdy_downstream_readcb(bufferevent *bev, void *ptr)
|
||||||
Downstream *downstream = reinterpret_cast<Downstream*>(ptr);
|
Downstream *downstream = reinterpret_cast<Downstream*>(ptr);
|
||||||
SpdyUpstream *upstream;
|
SpdyUpstream *upstream;
|
||||||
upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
upstream = static_cast<SpdyUpstream*>(downstream->get_upstream());
|
||||||
|
// If upstream SPDY stream was closed, we just close downstream,
|
||||||
|
// because there is no consumer now.
|
||||||
|
if(downstream->get_request_state() == Downstream::STREAM_CLOSED) {
|
||||||
|
upstream->remove_downstream(downstream);
|
||||||
|
delete downstream;
|
||||||
|
return;
|
||||||
|
}
|
||||||
int rv = downstream->parse_http_response();
|
int rv = downstream->parse_http_response();
|
||||||
if(rv == 0) {
|
if(rv != 0) {
|
||||||
if(downstream->get_request_state() == Downstream::STREAM_CLOSED &&
|
|
||||||
downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
|
||||||
upstream->get_downstream_queue()->remove(downstream);
|
|
||||||
delete downstream;
|
|
||||||
} else {
|
|
||||||
upstream->send();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(ENABLE_LOG) {
|
if(ENABLE_LOG) {
|
||||||
LOG(INFO) << "<downstream> http parser failure";
|
LOG(INFO) << "Downstream HTTP parser failure";
|
||||||
}
|
}
|
||||||
if(downstream->get_response_state() == Downstream::HEADER_COMPLETE) {
|
if(downstream->get_response_state() == Downstream::HEADER_COMPLETE) {
|
||||||
upstream->rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
|
upstream->rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
|
||||||
|
@ -291,10 +290,8 @@ void spdy_downstream_readcb(bufferevent *bev, void *ptr)
|
||||||
upstream->error_reply(downstream, 502);
|
upstream->error_reply(downstream, 502);
|
||||||
}
|
}
|
||||||
downstream->set_response_state(Downstream::MSG_COMPLETE);
|
downstream->set_response_state(Downstream::MSG_COMPLETE);
|
||||||
upstream->send();
|
|
||||||
// upstream->remove_downstream(downstream);
|
|
||||||
// delete downstream;
|
|
||||||
}
|
}
|
||||||
|
upstream->send();
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue