m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-06 18:58:25 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2020-01-06 18:58:25 +0100
commit5f02fa0e59dc84e12fae1fde61bdfa8edb5446b1 (patch)
tree53af9e3f704f37781556c7f0a1ed2c37d9388903 /src/main/java/pl/edu/mimuw/cloudatlas/agent
parent76b5ad38792c93cd530b5faf59c613e83a129d19 (diff)
Fix handling of multipart udp messages
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/UDUPServer.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/UDUPServer.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/UDUPServer.java
index 6807a86..fb79dc6 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/UDUPServer.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/UDUPServer.java
@@ -31,12 +31,11 @@ public class UDUPServer {
System.out.println("UDP " + this.address + " received packet from " + packet.getAddress());
if (packet.getOffset() == 0) {
- UDUPMessage msg = this.serializer.deserialize(packet.getData());
- System.out.println("UDP received message " + msg.getContent().getMessageId());
-
if (packet.getLength() == this.bufSize) {
this.addPartialMessageAndCheckSerialization(packet.getAddress(), packet.getData());
} else {
+ UDUPMessage msg = this.serializer.deserialize(packet.getData());
+ System.out.println("UDP received message " + msg.getContent().getMessageId());
if (msg.getContent().getDestinationModule() == ModuleType.TEST) {
System.out.println("UDP server: test message received");
} else if (msg.getContent().getDestinationModule() != ModuleType.UDP) {