|
@@ -7,6 +7,7 @@ public class ConnectionImplementation implements Connection {
|
|
|
|
|
|
private Link link;
|
|
|
private LinkedList<Port> participants;
|
|
|
+ private LinkedList<Port> removedParticipants;
|
|
|
private Protocol protocol;
|
|
|
private double packetLossRate;
|
|
|
private byte status;
|
|
@@ -14,6 +15,7 @@ public class ConnectionImplementation implements Connection {
|
|
|
public ConnectionImplementation(Link l, Protocol p) {
|
|
|
link = l;
|
|
|
participants=new LinkedList<Port>();
|
|
|
+ removedParticipants = new LinkedList<Port>();
|
|
|
this.protocol = p;
|
|
|
status =Connection.ACTIVE;
|
|
|
}
|
|
@@ -31,12 +33,18 @@ public class ConnectionImplementation implements Connection {
|
|
|
|
|
|
@Override
|
|
|
public Collection<Port> getParticipants() {
|
|
|
- return participants;
|
|
|
+ LinkedList<Port> out = new LinkedList<Port>();
|
|
|
+ out.addAll(participants);
|
|
|
+ out.addAll(removedParticipants);
|
|
|
+ return out;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean removeSmartDevice(Port sd) {
|
|
|
- return participants.remove(sd);
|
|
|
+ boolean removed = participants.remove(sd);
|
|
|
+ if(removed)
|
|
|
+ removedParticipants.add(sd);
|
|
|
+ return removed;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -61,6 +69,7 @@ public class ConnectionImplementation implements Connection {
|
|
|
|
|
|
@Override
|
|
|
public Collection<Packet> getTerminationPackages(long startTime) {
|
|
|
+ removedParticipants.clear();
|
|
|
return protocol.generateNextPakets(null, startTime, false);
|
|
|
}
|
|
|
|