synchronize partial reads and writes to a socket
This commit is contained in:
@@ -39,7 +39,7 @@ public enum ConstructingDeserializer implements MessageDeserializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public iMessage deserialize(DataInputStream in) throws IOException {
|
public synchronized iMessage deserialize(DataInputStream in) throws IOException {
|
||||||
int type = ((int) in.readByte()) & 0xff;
|
int type = ((int) in.readByte()) & 0xff;
|
||||||
try {
|
try {
|
||||||
return MSGS.get(type).getConstructor(DataInputStream.class).newInstance(in);
|
return MSGS.get(type).getConstructor(DataInputStream.class).newInstance(in);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class SerializedConnection implements IConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(iMessage message) throws IOException {
|
public synchronized void sendMessage(iMessage message) throws IOException {
|
||||||
message.writeHeader(out);
|
message.writeHeader(out);
|
||||||
message.write(out);
|
message.write(out);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user