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