*/
@Override
public void signalEvent(MessageArrivedEvent protocolEvent) {
if (protocolEvent != null) {
try {
ReliableProtocolMessage rcvdMsg = new ReliableProtocolMessage(protocolEvent.getContentBytes());
if (rcvdMsg.isAcknowledge()) {
Debug.println("RUDP Ack received for " + rcvdMsg.getSequence() + " at " + rcvdMsg.getIndex(), "programming5.net.sockets.ReliableUDPClient");
synchronized (messageTable) {
ReliableProtocolMessage[] sentSequence = messageTable.get(rcvdMsg.getSequence());
if (sentSequence != null) {
sentSequence[rcvdMsg.getIndex()-1].signalAcked();
}
}
}
else {
long sequence = rcvdMsg.getSequence();
ReliableProtocolMessage ack = new ReliableProtocolMessage(sequence, rcvdMsg.getIndex());
try {
client.replyTo(protocolEvent, ack.getMessageBytes());
}
catch (NetworkException ne) {
Debug.printStackTrace(ne);
}
String streamID = ((AsynchMessageArrivedEvent) protocolEvent).getSourceURL() + "/" + Long.toString(rcvdMsg.getSequence());