potential solution to session close

This commit is contained in:
sirjonasxx 2020-12-28 17:46:42 +01:00
parent 23648cf8bd
commit 065aebeb76

View File

@ -25,16 +25,12 @@ public class UnityPacketHandler extends PacketHandler {
@Override @Override
public void sendToStream(byte[] buffer) { public void sendToStream(byte[] buffer) {
synchronized (sendLock) { // synchronized (session) {
try {
byte[] prefix = new byte[]{(direction == HMessage.Direction.TOCLIENT ? ((byte)0) : ((byte)1))}; byte[] prefix = new byte[]{(direction == HMessage.Direction.TOCLIENT ? ((byte)0) : ((byte)1))};
byte[] combined = ByteArrayUtils.combineByteArrays(prefix, buffer); byte[] combined = ByteArrayUtils.combineByteArrays(prefix, buffer);
session.getBasicRemote().sendBinary(ByteBuffer.wrap(combined)); session.getAsyncRemote().sendBinary(ByteBuffer.wrap(combined));
} catch (IOException e) { // }
e.printStackTrace();
}
}
} }
@Override @Override