diff --git a/src/shrpx_accesslog.cc b/src/shrpx_accesslog.cc index 6fc975e9..e29b4fc0 100644 --- a/src/shrpx_accesslog.cc +++ b/src/shrpx_accesslog.cc @@ -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 diff --git a/src/shrpx_accesslog.h b/src/shrpx_accesslog.h index 5f150c3f..e53d7046 100644 --- a/src/shrpx_accesslog.h +++ b/src/shrpx_accesslog.h @@ -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 diff --git a/src/shrpx_spdy_upstream.cc b/src/shrpx_spdy_upstream.cc index b9d082d7..5624926a 100644 --- a/src/shrpx_spdy_upstream.cc +++ b/src/shrpx_spdy_upstream.cc @@ -98,6 +98,10 @@ void on_stream_close_callback } SpdyUpstream *upstream = reinterpret_cast(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);