shrpx: Log when SPDY stream is closed

This commit is contained in:
Tatsuhiro Tsujikawa 2012-09-15 17:27:20 +09:00
parent 7f481e42b0
commit c78e0ca055
3 changed files with 20 additions and 0 deletions

View File

@ -74,4 +74,18 @@ void upstream_spdy_stream(const std::string& client_ip, int32_t stream_id)
}
}
void upstream_spdy_stream_close(const std::string& client_ip,
int32_t stream_id)
{
char datestr[64];
get_datestr(datestr);
fprintf(stderr, "[%s] %s SPDY stream_id=%d closed\n",
datestr, client_ip.c_str(), stream_id);
fflush(stderr);
if(get_config()->use_syslog) {
syslog(LOG_INFO, "%s SPDY stream_id=%d closed\n",
client_ip.c_str(), stream_id);
}
}
} // namespace shrpx

View File

@ -33,6 +33,8 @@ namespace shrpx {
void upstream_connect(const std::string& client_ip);
void upstream_spdy_stream(const std::string& client_ip, int32_t stream_id);
void upstream_spdy_stream_close(const std::string& client_ip,
int32_t stream_id);
} // namespace shrpx

View File

@ -98,6 +98,10 @@ void on_stream_close_callback
}
SpdyUpstream *upstream = reinterpret_cast<SpdyUpstream*>(user_data);
Downstream *downstream = upstream->find_downstream(stream_id);
if(get_config()->accesslog) {
upstream_spdy_stream_close(upstream->get_client_handler()->get_ipaddr(),
stream_id);
}
if(downstream) {
if(downstream->get_request_state() == Downstream::CONNECT_FAIL) {
upstream->remove_downstream(downstream);