X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Futcp.c;fp=src%2Futcp.c;h=d6b0a590fed3670615a687ef9c01e44dab2454f1;hb=1597db834faf7a608e52de322bdb423a42f6fbf4;hp=00e02f6eb7244578d8a9d5c04b342ede293e3913;hpb=933047eadd101bddb3646ad7acbc0e48170049a0;p=meshlink diff --git a/src/utcp.c b/src/utcp.c index 00e02f6e..d6b0a590 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -875,6 +875,10 @@ static void ack_unreliable_framed(struct utcp_connection *c) { if(sent_packet) { if(left) { // We sent one packet but we have partial data left, (re)start the flush timer + if(!timespec_isset(&c->rtrx_timeout)) { + c->flush_needed = true; + } + start_flush_timer(c); } else { // There is no partial data in the send buffer, so stop the flush timer @@ -882,6 +886,7 @@ static void ack_unreliable_framed(struct utcp_connection *c) { } } else if(left && !timespec_isset(&c->rtrx_timeout)) { // We have partial data and we didn't start the flush timer yet + c->flush_needed = true; start_flush_timer(c); } } @@ -2790,3 +2795,9 @@ int utcp_get_flush_timeout(struct utcp *utcp) { void utcp_set_flush_timeout(struct utcp *utcp, int milliseconds) { utcp->flush_timeout = milliseconds; } + +bool utcp_get_flush_needed(struct utcp_connection *c) { + bool value = c->flush_needed; + c->flush_needed = false; + return value; +}