From: Stefan Metzmacher Date: Mon, 28 Apr 2025 15:54:31 +0000 (+0200) Subject: async_sock: split out read_packet_do() from read_packet_handler() X-Git-Tag: tevent-0.17.0~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4b5784cb599b9ee8cb4cf94feccb880ad94f1d3;p=thirdparty%2Fsamba.git async_sock: split out read_packet_do() from read_packet_handler() We'll call read_packet_do() in other places too in future. Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c index 6cfcafd9578..2c33380cd83 100644 --- a/lib/async_req/async_sock.c +++ b/lib/async_req/async_sock.c @@ -459,6 +459,7 @@ struct read_packet_state { static void read_packet_cleanup(struct tevent_req *req, enum tevent_req_state req_state); +static void read_packet_do(struct tevent_req *req); static void read_packet_handler(struct tevent_context *ev, struct tevent_fd *fde, uint16_t flags, void *private_data); @@ -509,12 +510,8 @@ static void read_packet_cleanup(struct tevent_req *req, TALLOC_FREE(state->fde); } -static void read_packet_handler(struct tevent_context *ev, - struct tevent_fd *fde, - uint16_t flags, void *private_data) +static void read_packet_do(struct tevent_req *req) { - struct tevent_req *req = talloc_get_type_abort( - private_data, struct tevent_req); struct read_packet_state *state = tevent_req_data(req, struct read_packet_state); size_t total = talloc_get_size(state->buf); @@ -590,6 +587,17 @@ static void read_packet_handler(struct tevent_context *ev, return; } state->buf = tmp; + +} + +static void read_packet_handler(struct tevent_context *ev, + struct tevent_fd *fde, + uint16_t flags, void *private_data) +{ + struct tevent_req *req = talloc_get_type_abort( + private_data, struct tevent_req); + + read_packet_do(req); } ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,