shrpx: Fix WINDOW_UPDATE may block until SpdyUpstream::send()

spdy_data_read_callback in SpdyDownstreamConnection calls
SpdyUpstream::resume_read() which submits WINDOW_UPDATE, but after
that they are not call SpdyUpstream::send(). This means that if no
pending outgoing data in upstream, then WINDOW_UPDATE is blocked until
SpdyUpstream::send() from somewhere. This change adds
SpdyUpstream::send() to resume_read() so that WINDOW_UPDATE is not
blocked.
This commit is contained in:
Tatsuhiro Tsujikawa 2013-02-27 22:55:44 +09:00
parent 7b3f57cef8
commit da36fc3953
2 changed files with 6 additions and 1 deletions

View File

@ -190,6 +190,11 @@ ssize_t spdy_data_read_callback(spdylay_session *session,
// In this case, downstream may be deleted. // In this case, downstream may be deleted.
return SPDYLAY_ERR_DEFERRED; return SPDYLAY_ERR_DEFERRED;
} }
// Check dconn is still alive because Upstream::resume_read()
// may delete downstream which will delete dconn.
if(sd->dconn == 0) {
return SPDYLAY_ERR_DEFERRED;
}
if(evbuffer_get_length(body) == 0) { if(evbuffer_get_length(body) == 0) {
return SPDYLAY_ERR_DEFERRED; return SPDYLAY_ERR_DEFERRED;
} }

View File

@ -898,7 +898,7 @@ int SpdyUpstream::resume_read(IOCtrlReason reason, Downstream *downstream)
window_update(downstream); window_update(downstream);
} }
} }
return 0; return send();
} }
} // namespace shrpx } // namespace shrpx