X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp.c;h=186b63e90bba16798f7fe4d897c40e4c554cfd19;hb=a4e2223575a4b0659bcbffeb73e636d5ba5847bc;hp=f46cdf7f649f0ee4ef77b0c8ebe0a673d5f24af0;hpb=0325c97f314cbab10cf9fce374598502e43341e6;p=utcp diff --git a/utcp.c b/utcp.c index f46cdf7..186b63e 100644 --- a/utcp.c +++ b/utcp.c @@ -486,7 +486,6 @@ static void retransmit(struct utcp_connection *c) { pkt->hdr.ack = c->rcv.nxt; pkt->hdr.ctl = ACK; uint32_t len = seqdiff(c->snd.nxt, c->snd.una); - fprintf(stderr, "retransmit %u %u %u\n", pkt->hdr.seq, pkt->hdr.ack, len); if(c->state == FIN_WAIT_1) len--; if(len > utcp->mtu) @@ -782,7 +781,6 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { c->dupack++; if(c->dupack == 3) { debug("Triplicate ACK\n"); - fprintf(stderr, "Triplicate ACK\n"); //TODO: Resend one packet and go to fast recovery mode. See RFC 6582. //We do a very simple variant here; reset the nxt pointer to the last acknowledged packet from the peer. //This will cause us to start retransmitting, but at the same speed as the incoming ACKs arrive, @@ -1176,7 +1174,10 @@ size_t utcp_get_sndbuf(struct utcp_connection *c) { } size_t utcp_get_sndbuf_free(struct utcp_connection *c) { - return buffer_free(&c->sndbuf); + if(c->state == ESTABLISHED || c->state == CLOSE_WAIT) + return buffer_free(&c->sndbuf); + else + return 0; } void utcp_set_sndbuf(struct utcp_connection *c, size_t size) {