evcon->closecb = cb;
evcon->closecb_arg = cbarg;
/*
- * xxx: we cannot just call evhttp_connection_start_detectclose here
- * that's valid only for client initiated connections that currently
- * do not process any requests.
+ * applications that stream to clients forever might want to
+ * detect when a browser or client has stopped receiving the
+ * stream. this would be detected on the next write in any case,
+ * however, we can release resources earlier using this.
*/
+ evhttp_connection_start_detectclose(evcon);
}
void
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
TAILQ_REMOVE(&evcon->requests, req, next);
+ /* delete possible close detection events */
+ evhttp_connection_stop_detectclose(evcon);
+
need_close = evhttp_is_connection_close(req->input_headers) ||
evhttp_is_connection_close(req->output_headers);