[core] ensure socket ready before checking connect

ensure socket ready for writing before checking connect() status

(sanity check in case request gets rescheduled for another reason
 before the socket is ready for writing)
personal/stbuehler/tests-path
Glenn Strauss 2022-03-25 02:11:35 -04:00
parent fa5e9b5364
commit 38a01d98ff
1 changed files with 2 additions and 0 deletions

View File

@ -1972,6 +1972,8 @@ static handler_t gw_write_request(gw_handler_ctx * const hctx, request_st * cons
__attribute_fallthrough__
case GW_STATE_CONNECT_DELAYED:
if (hctx->state == GW_STATE_CONNECT_DELAYED) { /*(not GW_STATE_INIT)*/
if (!(fdevent_fdnode_interest(hctx->fdn) & FDEVENT_OUT))
return HANDLER_WAIT_FOR_EVENT;
int socket_error = fdevent_connect_status(hctx->fd);
if (socket_error != 0) {
gw_proc_connect_error(r, hctx->host, hctx->proc, hctx->pid,