// There is no partial data in the send buffer, so stop the flush timer
stop_retransmit_timer(c);
}
+ } else if(left && !timespec_isset(&c->rtrx_timeout)) {
+ // We have partial data and we didn't start the flush timer yet
+ start_flush_timer(c);
}
}
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);