From: Guus Sliepen Date: Sat, 16 Aug 2014 15:48:45 +0000 (+0200) Subject: Handle FIN_WAIT_1 state when retransmitting. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=14892644247e46fc06f805d2653733bbdf45fb17;p=utcp Handle FIN_WAIT_1 state when retransmitting. --- diff --git a/utcp.c b/utcp.c index a65eb14..6588528 100644 --- a/utcp.c +++ b/utcp.c @@ -954,12 +954,19 @@ static void retransmit(struct utcp_connection *c) { break; case ESTABLISHED: + case FIN_WAIT_1: pkt.hdr.seq = c->snd.una; pkt.hdr.ack = c->rcv.nxt; pkt.hdr.ctl = ACK; uint32_t len = seqdiff(c->snd.nxt, c->snd.una); + if(c->state == FIN_WAIT_1) + len--; if(len > utcp->mtu) len = utcp->mtu; + else { + if(c->state == FIN_WAIT_1) + pkt.hdr.ctl |= FIN; + } memcpy(pkt.data, c->sndbuf, len); print_packet(c->utcp, "rtrx", &pkt, sizeof pkt.hdr + len); utcp->send(utcp, &pkt, sizeof pkt.hdr + len);