]> git.meshlink.io Git - meshlink/commitdiff
Check send buffer instead of receive buffer size when calling channel_poll().
authorGuus Sliepen <guus@meshlink.io>
Wed, 28 Sep 2022 09:12:41 +0000 (11:12 +0200)
committerGuus Sliepen <guus@meshlink.io>
Wed, 28 Sep 2022 20:29:52 +0000 (22:29 +0200)
src/meshlink.c

index a5bf2c90ac3f6f33916d8eafceadb98a24f56ebd..f425b4b2f2bad692fd3030673dfe63b4c4056056 100644 (file)
@@ -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);