changeset 629:d0d1cd3dfc11 dispose

fix UDP conection
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 14 Sep 2017 20:04:48 +0900
parents 71dfb0051be0
children 77adeb85c4d0
files src/main/java/alice/daemon/IncomingUdpConnection.java
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/daemon/IncomingUdpConnection.java	Thu Sep 14 19:01:18 2017 +0900
+++ b/src/main/java/alice/daemon/IncomingUdpConnection.java	Thu Sep 14 20:04:48 2017 +0900
@@ -44,10 +44,13 @@
                 receive.flip();
                 CommandMessage msg = unpacker.read(CommandMessage.class);
                 CommandType type = CommandType.getCommandTypeFromId(msg.type);
+                int dataSize = unpacker.readInt();
+                byte [] data = new byte[dataSize];
                 switch (type) {
                 case UPDATE:
                 case PUT:
-                    rData = new ReceiveData(unpacker.getSerializedByteArray(unpacker.readInt()));
+                    receive.get(data);
+                    rData = new ReceiveData(data);
                     cmd = new Command(type, null, null, rData, 0, 0, null, null, reverseKey);
 
                     if (msg.compressed){
@@ -74,8 +77,8 @@
                     break;
                 case REPLY:
                     cmd = manager.getAndRemoveCmd(msg.seq);
-
-                    rData = new ReceiveData(unpacker.getSerializedByteArray(unpacker.readInt()));
+                    receive.get(data);
+                    rData = new ReceiveData(data);
 
                     Command rCmd = new Command(type, null, null, rData, msg.index, msg.seq, null, null, "");
                     cmd.cs.ids.reply(cmd.receiver, rCmd);