Corrects reception of hole punch packets for TCP socket.

This commit is contained in:
chenzo 2012-06-22 15:57:34 +00:00
parent 5434a8ab41
commit 525d7e14d1

View File

@ -838,8 +838,10 @@ public class DelegatingSocket
int fb = inputStream.read();
int sb = inputStream.read();
// If we do not achieve to read the first bytes, then it was just an
// hole punch packet.
if(fb == -1 || sb == -1)
throw new SocketException("failed to read first two bytes");
return;
int desiredLength = (((fb & 0xff) << 8) | (sb & 0xff));
int readLen = 0;