commit 318a6c1a4be3e07520b2a6640a095272397819f8 from: Omar Polo date: Sat Jul 24 21:16:31 2021 UTC drop req_by_id_req, allow req_by_id to return NULL commit - 0d40acb17f9926cbf33284d1a0129a9d1984ac33 commit + 318a6c1a4be3e07520b2a6640a095272397819f8 blob - e6a8c5f417cf8aa0397279ec0a985f9a409b0e0c blob + f9309ca7a0960ee768a9138ac4a1b637b092b94a --- net.c +++ net.c @@ -58,7 +58,6 @@ static void close_with_err(struct req*, const char*) static void close_with_errf(struct req*, const char*, ...) __attribute__((format(printf, 2, 3))); static struct req *req_by_id(uint32_t); -static struct req *req_by_id_try(uint32_t); static void net_tls_handshake(int, short, void *); static void net_tls_readcb(int, short, void *); @@ -259,16 +258,6 @@ req_by_id(uint32_t id) { struct req *r; - if ((r = req_by_id_try(id)) == NULL) - die(); - return r; -} - -static struct req * -req_by_id_try(uint32_t id) -{ - struct req *r; - TAILQ_FOREACH(r, &reqhead, reqs) { if (r->id == id) return r; @@ -653,7 +642,7 @@ handle_proceed(struct imsg *imsg, size_t datalen) { struct req *req; - if ((req = req_by_id_try(imsg->hdr.peerid)) == NULL) + if ((req = req_by_id(imsg->hdr.peerid)) == NULL) return; bufferevent_enable(req->bev, EV_READ); @@ -664,7 +653,7 @@ handle_stop(struct imsg *imsg, size_t datalen) { struct req *req; - if ((req = req_by_id_try(imsg->hdr.peerid)) == NULL) + if ((req = req_by_id(imsg->hdr.peerid)) == NULL) return; close_conn(0, 0, req); }