Compare commits
2 Commits
9d5a1e7d1b
...
39b23c9949
Author | SHA1 | Date | |
---|---|---|---|
|
39b23c9949 | ||
|
4a8dc72374 |
Binary file not shown.
|
@ -94,7 +94,9 @@ public class NetworkManager {
|
||||||
Packet.writePacket(var2, yee);
|
Packet.writePacket(var2, yee);
|
||||||
yee.flush();
|
yee.flush();
|
||||||
try {
|
try {
|
||||||
|
if(this.isConnectionOpen()) {
|
||||||
socketOutputStream.write(sendBuffer.toByteArray());
|
socketOutputStream.write(sendBuffer.toByteArray());
|
||||||
|
}
|
||||||
} catch(SocketException e) {
|
} catch(SocketException e) {
|
||||||
if (e.getMessage().contains("connection abort") || e.getMessage().contains("connection reset")) {
|
if (e.getMessage().contains("connection abort") || e.getMessage().contains("connection reset")) {
|
||||||
this.networkShutdown("Connection reset");
|
this.networkShutdown("Connection reset");
|
||||||
|
@ -105,7 +107,9 @@ public class NetworkManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendBuffer.flush();
|
sendBuffer.flush();
|
||||||
|
if(this.isConnectionOpen()) {
|
||||||
socketOutputStream.flush();
|
socketOutputStream.flush();
|
||||||
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
this.sendQueueByteLength = oldSendQueue;
|
this.sendQueueByteLength = oldSendQueue;
|
||||||
|
@ -128,7 +132,9 @@ public class NetworkManager {
|
||||||
Packet.writePacket(var2, yee);
|
Packet.writePacket(var2, yee);
|
||||||
yee.flush();
|
yee.flush();
|
||||||
try {
|
try {
|
||||||
|
if(this.isConnectionOpen()) {
|
||||||
socketOutputStream.write(sendBuffer.toByteArray());
|
socketOutputStream.write(sendBuffer.toByteArray());
|
||||||
|
}
|
||||||
} catch(SocketException e) {
|
} catch(SocketException e) {
|
||||||
if (e.getMessage().contains("connection abort") || e.getMessage().contains("connection reset")) {
|
if (e.getMessage().contains("connection abort") || e.getMessage().contains("connection reset")) {
|
||||||
this.networkShutdown("Connection reset");
|
this.networkShutdown("Connection reset");
|
||||||
|
@ -139,7 +145,9 @@ public class NetworkManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendBuffer.flush();
|
sendBuffer.flush();
|
||||||
|
if(this.isConnectionOpen()) {
|
||||||
socketOutputStream.flush();
|
socketOutputStream.flush();
|
||||||
|
}
|
||||||
this.chunkDataSendCounter = 50;
|
this.chunkDataSendCounter = 50;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -317,7 +325,7 @@ public class NetworkManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isConnectionOpen() {
|
boolean isConnectionOpen() {
|
||||||
return networkSocket.isConnected();
|
return networkSocket != null && networkSocket.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Thread getReadThread(NetworkManager var0) {
|
static Thread getReadThread(NetworkManager var0) {
|
||||||
|
@ -336,7 +344,7 @@ public class NetworkManager {
|
||||||
byte[] data = bytesRead == buffer.length ? buffer : new byte[bytesRead];
|
byte[] data = bytesRead == buffer.length ? buffer : new byte[bytesRead];
|
||||||
System.arraycopy(buffer, 0, data, 0, data.length);
|
System.arraycopy(buffer, 0, data, 0, data.length);
|
||||||
return new ByteArrayInputStream(data);
|
return new ByteArrayInputStream(data);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user