277 } |
277 } |
278 |
278 |
279 EventHttpIO *io = evt_req_init(handler, conn); |
279 EventHttpIO *io = evt_req_init(handler, conn); |
280 if(!io) { |
280 if(!io) { |
281 log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | evt_req_init failed", (unsigned long long int)conn->id); |
281 log_ereport(LOG_DEBUG, "trace reqid: %016llx connection destroyed | evt_req_init failed", (unsigned long long int)conn->id); |
|
282 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)conn->id); |
282 connection_destroy(conn); |
283 connection_destroy(conn); |
283 free(start_request); |
284 free(start_request); |
284 free(event); |
285 free(event); |
285 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)conn->id); |
|
286 return; |
286 return; |
287 } |
287 } |
288 |
288 |
289 ZERO(event, sizeof(Event)); |
289 ZERO(event, sizeof(Event)); |
290 event->fn = conn->ssl && !conn->ssl_accepted ? evt_request_ssl_accept : evt_request_input; |
290 event->fn = conn->ssl && !conn->ssl_accepted ? evt_request_ssl_accept : evt_request_input; |
520 EventHttpIO *io = event->cookie; |
520 EventHttpIO *io = event->cookie; |
521 HttpParser *parser = io->parser; |
521 HttpParser *parser = io->parser; |
522 HTTPRequest *request = io->request; |
522 HTTPRequest *request = io->request; |
523 |
523 |
524 log_ereport(LOG_DEBUG, "trace reqid: %016llx request finish", (unsigned long long int)request->connection->id); |
524 log_ereport(LOG_DEBUG, "trace reqid: %016llx request finish", (unsigned long long int)request->connection->id); |
|
525 uint64_t reqid = request->connection->id; |
525 |
526 |
526 // remove timeout |
527 // remove timeout |
527 if(io->watch.intdata) { |
528 if(io->watch.intdata) { |
528 ev_watchlist_remove(h, &io->watch); |
529 ev_watchlist_remove(h, &io->watch); |
529 } |
530 } |
545 http_request_cleanup(request); |
546 http_request_cleanup(request); |
546 http_parser_free(parser); |
547 http_parser_free(parser); |
547 |
548 |
548 free(io); |
549 free(io); |
549 free(event); |
550 free(event); |
550 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)request->connection->id); |
551 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)reqid); |
551 |
552 |
552 return 0; |
553 return 0; |
553 } |
554 } |
554 |
555 |
555 int evt_request_error(EventHandler *h, Event *event) { |
556 int evt_request_error(EventHandler *h, Event *event) { |
556 EventHttpIO *io = event->cookie; |
557 EventHttpIO *io = event->cookie; |
557 HttpParser *parser = io->parser; |
558 HttpParser *parser = io->parser; |
558 HTTPRequest *request = io->request; |
559 HTTPRequest *request = io->request; |
|
560 uint64_t reqid = request->connection->id; |
559 |
561 |
560 log_ereport(LOG_DEBUG, "trace reqid: %016llx request error", (unsigned long long int)request->connection->id); |
562 log_ereport(LOG_DEBUG, "trace reqid: %016llx request error", (unsigned long long int)request->connection->id); |
561 |
563 |
562 if(event->error) { |
564 if(event->error) { |
563 log_ereport(LOG_VERBOSE, "sessionhandler http io error: %d fd: %d", io->error, request->connection->fd); |
565 log_ereport(LOG_VERBOSE, "sessionhandler http io error: %d fd: %d", io->error, request->connection->fd); |
576 http_request_cleanup(request); |
578 http_request_cleanup(request); |
577 http_parser_free(parser); |
579 http_parser_free(parser); |
578 |
580 |
579 free(io); |
581 free(io); |
580 free(event); |
582 free(event); |
581 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)request->connection->id); |
583 log_ereport(LOG_DEBUG, "trace reqid: %016llx free event", (unsigned long long int)reqid); |
582 |
584 |
583 return 0; |
585 return 0; |
584 } |
586 } |
585 |
587 |
586 void evt_keep_alive(SessionHandler *handler, Connection *conn) { |
588 void evt_keep_alive(SessionHandler *handler, Connection *conn) { |