apr_bucket* bucket = APR_BRIGADE_FIRST(bb);
if (APR_BUCKET_IS_METADATA(bucket)) {
- /* we do nothing regarding any meta here */
+ /* we do nothing regardih2_filter_cin_timeout_setng any meta here */
}
else {
const char *bucket_data = NULL;
return cin;
}
-void h2_filter_cin_timeout_set(h2_filter_cin *cin, int timeout_secs)
+void h2_filter_cin_timeout_set(h2_filter_cin *cin, apr_interval_time_t timeout)
{
- cin->timeout_secs = timeout_secs;
+ cin->timeout = timeout;
}
apr_status_t h2_filter_core_input(ap_filter_t* f,
{
h2_filter_cin *cin = f->ctx;
apr_status_t status = APR_SUCCESS;
- apr_time_t saved_timeout = UNSET;
+ apr_interval_time_t saved_timeout = UNSET;
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, f->c,
- "core_input(%ld): read, %s, mode=%d, readbytes=%ld, timeout=%d",
+ "core_input(%ld): read, %s, mode=%d, readbytes=%ld",
(long)f->c->id, (block == APR_BLOCK_READ)? "BLOCK_READ" : "NONBLOCK_READ",
- mode, (long)readbytes, cin->timeout_secs);
+ mode, (long)readbytes);
if (mode == AP_MODE_INIT || mode == AP_MODE_SPECULATIVE) {
return ap_get_brigade(f->next, brigade, mode, block, readbytes);
* in the scoreboard is preserved.
*/
if (block == APR_BLOCK_READ) {
- if (cin->timeout_secs > 0) {
- apr_time_t t = apr_time_from_sec(cin->timeout_secs);
+ if (cin->timeout > 0) {
apr_socket_timeout_get(cin->socket, &saved_timeout);
- apr_socket_timeout_set(cin->socket, t);
+ apr_socket_timeout_set(cin->socket, cin->timeout);
}
}
status = ap_get_brigade(f->next, cin->bb, AP_MODE_READBYTES,
h2_filter_cin_cb *cb;
void *cb_ctx;
apr_socket_t *socket;
- int timeout_secs;
+ apr_interval_time_t timeout;
apr_time_t start_read;
} h2_filter_cin;
h2_filter_cin *h2_filter_cin_create(apr_pool_t *p, h2_filter_cin_cb *cb, void *ctx);
-void h2_filter_cin_timeout_set(h2_filter_cin *cin, int timeout_secs);
+void h2_filter_cin_timeout_set(h2_filter_cin *cin, apr_interval_time_t timeout);
apr_status_t h2_filter_core_input(ap_filter_t* filter,
apr_bucket_brigade* brigade,
#ifndef mod_h2_h2_private_h
#define mod_h2_h2_private_h
+#include <apr_time.h>
+
#include <nghttp2/nghttp2.h>
extern module AP_MODULE_DECLARE_DATA http2_module;
/* When we have no streams, no task event are possible,
* switch to blocking reads */
transit(session, "no io", H2_SESSION_ST_IDLE);
- session->keepalive_until = apr_time_now() + session->s->keep_alive_timeout;
+ session->idle_until = apr_time_now() + session->s->keep_alive_timeout;
}
}
else if (!h2_stream_set_has_unsubmitted(session->streams)
&& !h2_stream_set_has_suspended(session->streams)) {
/* none of our streams is waiting for a response or
* new output data from task processing,
- * switch to blocking reads. */
+ * switch to blocking reads. We are probably waiting on
+ * window updates. */
transit(session, "no io", H2_SESSION_ST_IDLE);
- session->keepalive_until = apr_time_now() + session->s->keep_alive_timeout;
+ session->idle_until = apr_time_now() + session->s->timeout;
}
else {
/* Unable to do blocking reads, as we wait on events from
dispatch_event(session, H2_SESSION_EV_DATA_READ, 0, NULL);
}
else if (APR_STATUS_IS_EAGAIN(status) || APR_STATUS_IS_TIMEUP(status)) {
- if (apr_time_now() > session->keepalive_until) {
+ if (apr_time_now() > session->idle_until) {
dispatch_event(session, H2_SESSION_EV_CONN_TIMEOUT, 0, NULL);
}
else {
/* nothing to read */
}
else if (APR_STATUS_IS_TIMEUP(status)) {
- if (apr_time_now() > session->keepalive_until) {
+ if (apr_time_now() > session->idle_until) {
dispatch_event(session, H2_SESSION_EV_CONN_TIMEOUT, 0, "timeout");
}
- /* continue keepalive handling */
+ /* continue reading handling */
}
else {
dispatch_event(session, H2_SESSION_EV_CONN_ERROR, 0, NULL);
apr_size_t max_stream_mem; /* max buffer memory for a single stream */
apr_time_t start_wait; /* Time we started waiting for sth. to happen */
- apr_time_t keepalive_until; /* Time when we stop keeing an idle conn alive */
+ apr_time_t idle_until; /* Time we shut down due to sheer boredom */
apr_pool_t *pool; /* pool to use in session handling */
apr_bucket_brigade *bbtmp; /* brigade for keeping temporary data */
#include <apr_optional.h>
#include <apr_optional_hooks.h>
+#include <apr_time.h>
#include <apr_want.h>
#include <httpd.h>