From: Guus Sliepen Date: Wed, 28 Sep 2022 09:12:41 +0000 (+0200) Subject: Check send buffer instead of receive buffer size when calling channel_poll(). X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=22cdfa47418f42bde9e51bfbc864f2aefc05667e Check send buffer instead of receive buffer size when calling channel_poll(). --- diff --git a/src/meshlink.c b/src/meshlink.c index a5bf2c90..f425b4b2 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -4515,7 +4515,7 @@ bool meshlink_channel_aio_send(meshlink_handle_t *mesh, meshlink_channel_t *chan /* Ensure the poll callback is set, and call it right now to push data if possible */ utcp_set_poll_cb(channel->c, channel_poll); - size_t todo = MIN(len, utcp_get_rcvbuf_free(channel->c)); + size_t todo = MIN(len, utcp_get_sndbuf_free(channel->c)); if(todo) { channel_poll(channel->c, todo); @@ -4560,7 +4560,7 @@ bool meshlink_channel_aio_fd_send(meshlink_handle_t *mesh, meshlink_channel_t *c /* Ensure the poll callback is set, and call it right now to push data if possible */ utcp_set_poll_cb(channel->c, channel_poll); - size_t left = utcp_get_rcvbuf_free(channel->c); + size_t left = utcp_get_sndbuf_free(channel->c); if(left) { channel_poll(channel->c, left);