Попытка исправления краша ядра
This commit is contained in:
+6
@@ -21,14 +21,19 @@ public class SocketDataChannel extends DataChannel {
|
||||
|
||||
@Override
|
||||
public void sendImpl(DataPacket packet) throws IOException {
|
||||
if(socket.isClosed()) return;
|
||||
synchronized (outputStream) {
|
||||
outputStream.writeUTF(packet.name);
|
||||
outputStream.writeByte(packet.formatId);
|
||||
outputStream.writeInt(packet.data.length);
|
||||
outputStream.write(packet.data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataPacket receiveImpl() throws IOException {
|
||||
if(socket.isClosed()) return null;
|
||||
synchronized (inputStream) {
|
||||
String name = inputStream.readUTF();
|
||||
int formatId = inputStream.readByte();
|
||||
int size = inputStream.readInt();
|
||||
@@ -39,6 +44,7 @@ public class SocketDataChannel extends DataChannel {
|
||||
inputStream.readFully(data);
|
||||
return new DataPacket(name, formatId, data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeImpl() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user