From 822f17e264abab65fda080a6c8361fe2b9c0cfdf Mon Sep 17 00:00:00 2001 From: "Claudio Maggioni (maggicl)" Date: Fri, 8 May 2020 14:29:08 +0200 Subject: [PATCH] hw2: preparing for submission --- hw2/src/impl/GBNTReceiver.java | 12 +++++++++++- hw2/src/impl/GBNTSender.java | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/hw2/src/impl/GBNTReceiver.java b/hw2/src/impl/GBNTReceiver.java index a45f83d..3f63d1e 100644 --- a/hw2/src/impl/GBNTReceiver.java +++ b/hw2/src/impl/GBNTReceiver.java @@ -1,3 +1,14 @@ +/* + * GBNTReceiver - Claudio Maggioni (2020) + * NTW2020 HW2 + * + * No external source was used to create this file, other than regular course material. + * + * Note on implementation: change value of constant RECEIVER_TIMEOUT_MS to change the + * value of the receiver disconnection timeout. + */ + + package impl; import transport.Receiver; @@ -47,7 +58,6 @@ public class GBNTReceiver extends Receiver implements TimeoutAction { @Override protected void unreliableReceive(byte[] bytes, int offset, int length) { if (state == State.CLOSED) return; - //System.out.println("State: " + state + " receiving: " + length); cancelTimeout(this); setTimeout(RECEIVER_TIMEOUT_MS, this); switch(this.state) { diff --git a/hw2/src/impl/GBNTSender.java b/hw2/src/impl/GBNTSender.java index 72192a8..7aa834d 100644 --- a/hw2/src/impl/GBNTSender.java +++ b/hw2/src/impl/GBNTSender.java @@ -1,3 +1,13 @@ +/* + * GBNTSender - Claudio Maggioni (2020) + * NTW2020 HW2 + * + * No external source was used to create this file, other than regular course material. + * + * Note on implementation: change value of constant W to change the size of the otherwise + * fixed window. + */ + package impl; import transport.TimeoutAction; @@ -27,8 +37,6 @@ public class GBNTSender extends transport.Sender implements TimeoutAction { private final Map packetMap = new HashMap<>(); private Semaphore s = new Semaphore(0); - private static final int MAX_PACKET_SIZE = 128; - private class Packet { private final byte[] contents; private final char sequence;