Remove unused codes in ngx_http_upstream_connect

meng lynch lynch.meng at hotmail.com
Thu Apr 20 14:24:53 UTC 2023


Hello guys,

Should the code from line 1517 to 1519 be removed? Because u->state is reallocated in line 1521.

1509 static void
1510 ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
1511 {
1512     ngx_int_t          rc;
1513     ngx_connection_t  *c;
1514
1515     r->connection->log->action = "connecting to upstream";
1516
- 1517     if (u->state && u->state->response_time == (ngx_msec_t) -1) {
- 1518         u->state->response_time = ngx_current_msec - u->start_time;
- 1519     }
1520
1521     u->state = ngx_array_push(r->upstream_states);
1522     if (u->state == NULL) {
1523         ngx_http_upstream_finalize_request(r, u,
1524                                            NGX_HTTP_INTERNAL_SERVER_ERROR);
1525         return;
1526     }



More information about the nginx-devel mailing list