hw2: preparing for submission
This commit is contained in:
parent
059c627b29
commit
822f17e264
2 changed files with 21 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -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<Character, Packet> 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;
|
||||
|
|
Reference in a new issue