]> git.meshlink.io Git - meshlink/commitdiff
Correctly report the maximum allowed send size in the poll callback for framed channels.
authorGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:02:22 +0000 (21:02 +0200)
committerGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:19:07 +0000 (21:19 +0200)
src/utcp.c

index cbc094a1cbe060658969cc145fdf17c62d4ecdf9..8ef59a063fdf8f3af5a1fbb021deced7775c7e73 100644 (file)
@@ -2433,7 +2433,7 @@ struct timespec utcp_timeout(struct utcp *utcp) {
                if(c->poll) {
                        if((c->state == ESTABLISHED || c->state == CLOSE_WAIT) && c->do_poll) {
                                c->do_poll = false;
-                               uint32_t len = buffer_free(&c->sndbuf);
+                               uint32_t len = is_framed(c) ? min(buffer_free(&c->sndbuf), MAX_UNRELIABLE_SIZE) : buffer_free(&c->sndbuf);
 
                                if(len) {
                                        c->poll(c, len);