Skip to content

Commit

Permalink
save and restore
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Apr 8, 2024
1 parent 9897908 commit 4be402b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions ngx_pq_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,13 +843,31 @@ static void ngx_pq_event_handler(ngx_http_request_t *r, ngx_http_upstream_t *u)
case CONNECTION_SSL_STARTUP: ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "CONNECTION_SSL_STARTUP"); break;
case CONNECTION_STARTED: ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "CONNECTION_STARTED"); break;
}
if (c->read->timedout || c->write->timedout) return ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT);
if (c->read->timedout || c->write->timedout) {
ngx_http_upstream_handler_pt read_event_handler = u->read_event_handler;
ngx_http_upstream_handler_pt write_event_handler = u->write_event_handler;
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT);
u->read_event_handler = read_event_handler;
u->write_event_handler = write_event_handler;
}
rc = ngx_pq_poll(s, d);
ret:
switch (rc) {
case NGX_AGAIN: break;
case NGX_BUSY: ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE); break;
case NGX_DECLINED: ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); break;
case NGX_BUSY: {
ngx_http_upstream_handler_pt read_event_handler = u->read_event_handler;
ngx_http_upstream_handler_pt write_event_handler = u->write_event_handler;
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE);
u->read_event_handler = read_event_handler;
u->write_event_handler = write_event_handler;
} break;
case NGX_DECLINED: {
ngx_http_upstream_handler_pt read_event_handler = u->read_event_handler;
ngx_http_upstream_handler_pt write_event_handler = u->write_event_handler;
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
u->read_event_handler = read_event_handler;
u->write_event_handler = write_event_handler;
} break;
default: ngx_http_upstream_finalize_request(r, u, rc); break;
}
}
Expand Down

0 comments on commit 4be402b

Please sign in to comment.