From 8a83e82ff75cd4841d8cdfb244ed5b42ebc5ccd4 Mon Sep 17 00:00:00 2001 From: cozis Date: Wed, 1 Nov 2023 23:40:39 +0100 Subject: [PATCH] removed debug logs and made it so 'make clean' also cleans 3p/libtuntap --- makefile | 2 +- src/tcp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index ab2986e..5079721 100644 --- a/makefile +++ b/makefile @@ -81,5 +81,5 @@ $(EXAMPLE_1): lib $(EXAMPLE_CFILES_1) $(EXAMPLE_HFILES_1) $(CC) -o $@ $(EXAMPLE_CFILES_1) $(CFLAGS) $(EXAMPLE_LFLAGS) -I$(OUTDIR) -L$(OUTDIR) clean: - rm -fr $(OBJDIR) $(OUTDIR) + rm -fr $(OBJDIR) $(OUTDIR) 3p/libtuntap/build mkdir obj out diff --git a/src/tcp.c b/src/tcp.c index d537b14..318eb02 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -1197,7 +1197,7 @@ void tcp_process_segment(tcp_state_t *tcp, ip_address_t sender, // and that SND.WL2 records the acknowledgment number of the last // segment used to update SND.WND. The check here prevents using // old segments to update the window. - TCP_DEBUG_LOG("ack=%lld, UNA=%lld, NXT=%lld", ack, c->snd_una, c->snd_nxt); + if (ack > c->snd_nxt) { // Peer acked something not sent yet transmit(c, TCP_FLAG_ACK, true); @@ -1261,7 +1261,7 @@ void tcp_process_segment(tcp_state_t *tcp, ip_address_t sender, // In addition to the processing for the ESTABLISHED state, if the // ACK acknowledges our FIN, then enter the TIME-WAIT state; // otherwise, ignore the segment. - TCP_DEBUG_LOG("ACK with seq=%lld, ack=%lld reached here (NXT=%lld)", seq, ack, c->snd_nxt); + if (ack == c->snd_nxt) { TCP_DEBUG_LOG("And here"); // Everything was ACKed, so if a FIN was sent that was ACKed too.