ASSERT (hc->flags & HTTP_CONN_F_IS_SERVER);
/* first request - create request ctx and notify app about new conn */
req = http1_conn_alloc_req (hc);
- http_conn_accept_request (hc, req);
+ if (http_conn_accept_request (hc, req))
+ {
+ http_disconnect_transport (hc);
+ return;
+ }
http_stats_connections_accepted_inc (hc->c_thread_index);
http_req_state_change (req, HTTP_REQ_STATE_WAIT_TRANSPORT_METHOD);
hc->flags &= ~HTTP_CONN_F_NO_APP_SESSION;
return;
req = http1_conn_get_req (hc);
- session_transport_delete_notify (&req->connection);
+ /* do not notify if accept or connect failed */
+ if (req->c_s_index != SESSION_INVALID_INDEX)
+ session_transport_delete_notify (&req->connection);
http1_conn_free_req (hc);
}
req = http2_conn_alloc_req (hc, 0);
http2_req_set_stream_id (req, h2c, fh->stream_id, 0);
req->dispatch_headers_cb = http2_sched_dispatch_resp_headers;
- http_conn_accept_request (hc, &req->base);
+ if (http_conn_accept_request (hc, &req->base))
+ {
+ http2_conn_free_req (h2c, req, hc->c_thread_index);
+ return HTTP2_ERROR_INTERNAL_ERROR;
+ }
http_req_state_change (&req->base, HTTP_REQ_STATE_WAIT_TRANSPORT_METHOD);
req->stream_state = HTTP2_STREAM_STATE_OPEN;
hc->flags &= ~HTTP_CONN_F_NO_APP_SESSION;
HTTP_DBG (1, "failed to allocate fifos");
req->c_s_index = SESSION_INVALID_INDEX;
session_free (as);
- hc->flags |= HTTP_CONN_F_NO_APP_SESSION;
return rv;
}
HTTP_DBG (1, "app accept returned");
req->c_s_index = SESSION_INVALID_INDEX;
session_free (as);
- hc->flags |= HTTP_CONN_F_NO_APP_SESSION;
return rv;
}