@@ -74,6 +74,8 @@ static int nxt_unit_request_check_response_port(nxt_unit_request_info_t *req,
74
74
static int nxt_unit_send_req_headers_ack (nxt_unit_request_info_t * req );
75
75
static int nxt_unit_process_websocket (nxt_unit_ctx_t * ctx ,
76
76
nxt_unit_recv_msg_t * recv_msg );
77
+ static int nxt_unit_process_client_error (nxt_unit_ctx_t * ctx ,
78
+ nxt_unit_recv_msg_t * recv_msg );
77
79
static int nxt_unit_process_shm_ack (nxt_unit_ctx_t * ctx );
78
80
static nxt_unit_request_info_impl_t * nxt_unit_request_info_get (
79
81
nxt_unit_ctx_t * ctx );
@@ -1121,6 +1123,9 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_read_buf_t *rbuf,
1121
1123
rc = nxt_unit_process_websocket (ctx , & recv_msg );
1122
1124
break ;
1123
1125
1126
+ case _NXT_PORT_MSG_CLIENT_ERROR :
1127
+ rc = nxt_unit_process_client_error (ctx , & recv_msg );
1128
+ break ;
1124
1129
case _NXT_PORT_MSG_REMOVE_PID :
1125
1130
if (nxt_slow_path (recv_msg .size != sizeof (pid ))) {
1126
1131
nxt_unit_alert (ctx , "#%" PRIu32 ": remove_pid: invalid message size "
@@ -1377,18 +1382,16 @@ nxt_unit_process_req_headers(nxt_unit_ctx_t *ctx, nxt_unit_recv_msg_t *recv_msg,
1377
1382
1378
1383
lib = nxt_container_of (ctx -> unit , nxt_unit_impl_t , unit );
1379
1384
1385
+ res = nxt_unit_request_hash_add (ctx , req );
1386
+ if (nxt_slow_path (res != NXT_UNIT_OK )) {
1387
+ nxt_unit_req_warn (req , "failed to add request to hash" );
1388
+ nxt_unit_request_done (req , NXT_UNIT_ERROR );
1389
+ return NXT_UNIT_ERROR ;
1390
+ }
1391
+
1380
1392
if (req -> content_length
1381
1393
> (uint64_t ) (req -> content_buf -> end - req -> content_buf -> free ))
1382
1394
{
1383
- res = nxt_unit_request_hash_add (ctx , req );
1384
- if (nxt_slow_path (res != NXT_UNIT_OK )) {
1385
- nxt_unit_req_warn (req , "failed to add request to hash" );
1386
-
1387
- nxt_unit_request_done (req , NXT_UNIT_ERROR );
1388
-
1389
- return NXT_UNIT_ERROR ;
1390
- }
1391
-
1392
1395
/*
1393
1396
* If application have separate data handler, we may start
1394
1397
* request processing and process data when it is arrived.
@@ -1418,7 +1421,7 @@ nxt_unit_process_req_body(nxt_unit_ctx_t *ctx, nxt_unit_recv_msg_t *recv_msg)
1418
1421
nxt_unit_mmap_buf_t * b ;
1419
1422
nxt_unit_request_info_t * req ;
1420
1423
1421
- req = nxt_unit_request_hash_find (ctx , recv_msg -> stream , recv_msg -> last );
1424
+ req = nxt_unit_request_hash_find (ctx , recv_msg -> stream , 0 );
1422
1425
if (req == NULL ) {
1423
1426
return NXT_UNIT_OK ;
1424
1427
}
@@ -1722,6 +1725,26 @@ nxt_unit_process_websocket(nxt_unit_ctx_t *ctx, nxt_unit_recv_msg_t *recv_msg)
1722
1725
return NXT_UNIT_OK ;
1723
1726
}
1724
1727
1728
+ static int
1729
+ nxt_unit_process_client_error (nxt_unit_ctx_t * ctx , nxt_unit_recv_msg_t * recv_msg )
1730
+ {
1731
+ nxt_unit_request_info_t * req ;
1732
+ nxt_unit_impl_t * lib ;
1733
+
1734
+ req = nxt_unit_request_hash_find (ctx , recv_msg -> stream , 0 );
1735
+
1736
+ if (req == NULL ) {
1737
+ return NXT_UNIT_OK ;
1738
+ }
1739
+
1740
+ lib = nxt_container_of (ctx -> unit , nxt_unit_impl_t , unit );
1741
+
1742
+ if (lib -> callbacks .close_handler ) {
1743
+ lib -> callbacks .close_handler (req );
1744
+ }
1745
+
1746
+ return NXT_UNIT_OK ;
1747
+ }
1725
1748
1726
1749
static int
1727
1750
nxt_unit_process_shm_ack (nxt_unit_ctx_t * ctx )
0 commit comments