Commented out throws in the BinaryMessageDecoder for messages we ignore as they were not errors and instead were causing the program to stop if they're received
- commented out throw from default, chatter text, yachactioncode, yachteventcode, displaytextmessage states #story[881]
This commit is contained in:
@@ -148,7 +148,7 @@ public class BinaryMessageDecoder {
|
||||
case DISPLAYTEXTMESSAGE:
|
||||
//System.out.println("Display Text Message");
|
||||
//No decoder for this.
|
||||
throw new InvalidMessageException("Cannot decode DISPLAYTEXTMESSAGE - no decoder.");
|
||||
//throw new InvalidMessageException("Cannot decode DISPLAYTEXTMESSAGE - no decoder.");
|
||||
|
||||
case XMLMESSAGE:
|
||||
//System.out.println("XML Message!");
|
||||
@@ -164,17 +164,17 @@ public class BinaryMessageDecoder {
|
||||
case YACHTEVENTCODE:
|
||||
//System.out.println("Yacht Action Code!");
|
||||
//No decoder for this.
|
||||
throw new InvalidMessageException("Cannot decode YACHTEVENTCODE - no decoder.");
|
||||
//throw new InvalidMessageException("Cannot decode YACHTEVENTCODE - no decoder.");
|
||||
|
||||
case YACHTACTIONCODE:
|
||||
//System.out.println("Yacht Action Code!");
|
||||
//No decoder for this.
|
||||
throw new InvalidMessageException("Cannot decode YACHTACTIONCODE - no decoder.");
|
||||
//throw new InvalidMessageException("Cannot decode YACHTACTIONCODE - no decoder.");
|
||||
|
||||
case CHATTERTEXT:
|
||||
//System.out.println("Chatter Text Message!");
|
||||
//No decoder for this.
|
||||
throw new InvalidMessageException("Cannot decode CHATTERTEXT - no decoder.");
|
||||
//throw new InvalidMessageException("Cannot decode CHATTERTEXT - no decoder.");
|
||||
|
||||
case BOATLOCATION:
|
||||
//System.out.println("Boat Location Message!");
|
||||
@@ -198,10 +198,10 @@ public class BinaryMessageDecoder {
|
||||
|
||||
default:
|
||||
//System.out.println("Broken Message!");
|
||||
throw new InvalidMessageException("Broken message! Did not recognise message type: " + headerMessageType + ".");
|
||||
//throw new InvalidMessageException("Broken message! Did not recognise message type: " + headerMessageType + ".");
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
||||
*/
|
||||
public class VisualiserInput implements Runnable {
|
||||
|
||||
///A queue that contains messages that have been received, and need to be handled.
|
||||
private final ArrayBlockingQueue<AC35Data> messagesReceivedQueue = new ArrayBlockingQueue<>(1000000);//We have room for 1,000,000. Is this much capacity actually needed?
|
||||
|
||||
///Timestamp of the last heartbeat.
|
||||
private long lastHeartbeatTime = -1;
|
||||
///Sequence number of the last heartbeat.
|
||||
@@ -254,7 +257,11 @@ public class VisualiserInput implements Runnable {
|
||||
System.err.println("Unable to read message: " + e.getMessage());
|
||||
//Continue to the next loop iteration/message.
|
||||
continue;
|
||||
}
|
||||
}/*
|
||||
|
||||
//Add it to message queue.
|
||||
this.messagesReceivedQueue.add(message);*/
|
||||
|
||||
|
||||
//Checks which message is being received and does what is needed for that message.
|
||||
//Heartbeat.
|
||||
|
||||
Reference in New Issue
Block a user