Permalink
Browse files

Fixing dropped connection throwing an Eof

  • Loading branch information...
MattTuttle committed Feb 25, 2014
1 parent 201c8bb commit da0cf72ce413b4a9bbbc27e250fbdc871303c0a9
Showing with 8 additions and 2 deletions.
  1. +8 −2 hxnet/tcp/Server.hx
View
@@ -53,14 +53,20 @@ class Server implements hxnet.interfaces.Server
}
else
{
var protocol:Protocol = socket.custom;
var cnx:Protocol = socket.custom;
bytesReceived = 0;
while (bytesReceived < len)
{
try
{
byte = socket.input.readByte();
}
catch (e:haxe.io.Eof)
{
cnx.loseConnection("disconnected");
socket.close();
readSockets.remove(socket);
}
catch (e:haxe.io.Error)
{
// end of stream
@@ -78,7 +84,7 @@ class Server implements hxnet.interfaces.Server
// check that buffer was filled
if (bytesReceived > 0)
{
protocol.dataReceived(new BytesInput(buffer, 0, bytesReceived));
cnx.dataReceived(new BytesInput(buffer, 0, bytesReceived));
}
}
}

0 comments on commit da0cf72

Please sign in to comment.