Improved packet handling

This commit is contained in:
Tahg authored and Erik Broes committed 2011-05-28 00:33:16 +02:00
1 parent 1784e42d5f
commit 9ec5d8b5df
2 files changed
+11 -1

No files matched your search

@@ -69,6 +69,11 @@ public abstract class Packet {
int i;
try {
// CraftBukkit start - sleep while nothing to do
while(datainputstream.available() <= 0) {
Thread.sleep(10);
}
// CraftBukkit end
i = datainputstream.read();
if (i == -1) {
return null;
@@ -97,6 +102,10 @@ public abstract class Packet {
System.out.println("Connection reset");
return null;
}
catch (InterruptedException exception) {
System.out.println("Thread exception");
return null;
}
// CraftBukkit end
PacketCounter packetcounter = (PacketCounter) e.get(Integer.valueOf(i));