Skip to content

Commit

Permalink
fix bug: The Handler function is not set correctly
Browse files Browse the repository at this point in the history
This problem occurs when the same connection is
requested multiple times

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Dec 26, 2020
1 parent 06e3d76 commit 943eb35
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ static void conn_done(struct uh_connection *conn)
ev_io_start(loop, &conn->iow);

ev_timer_stop(loop, &conn->timer);

/* This is needed for a connection requested multiple times */
conn->handler = NULL;
}

static void conn_send(struct uh_connection *conn, const void *data, ssize_t len)
Expand Down Expand Up @@ -359,9 +362,6 @@ static int on_headers_complete(struct http_parser *parser)

http_parser_parse_url(O2D(conn, req->url.offset), req->url.length, false, &conn->url_parser);

if (conn->handler)
return 0;

path = conn->get_path(conn);

while (h) {
Expand Down

0 comments on commit 943eb35

Please sign in to comment.