mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 20:25:51 +12:00
Update HISP
This commit is contained in:
parent
d73cd92c52
commit
29e5ab8093
8 changed files with 31 additions and 23 deletions
|
@ -86,8 +86,16 @@ namespace HISP.Server.Network
|
|||
|
||||
internal override void receivePackets(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
if (!base.checkForError(e))
|
||||
ProcessReceivedPackets(e.BytesTransferred, e.Buffer);
|
||||
try
|
||||
{
|
||||
if (!base.checkForError(e))
|
||||
ProcessReceivedPackets(e.BytesTransferred, e.Buffer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorPrint(ex.StackTrace);
|
||||
try { this.Disconnect(); } catch (Exception) { };
|
||||
};
|
||||
}
|
||||
|
||||
public override void Send(byte[] data)
|
||||
|
|
|
@ -36,15 +36,20 @@ namespace HISP.Server.Network
|
|||
}
|
||||
internal virtual void receivePackets(object sender, SocketAsyncEventArgs e)
|
||||
{
|
||||
do
|
||||
try
|
||||
{
|
||||
if (!checkForError(e))
|
||||
do
|
||||
{
|
||||
if (checkForError(e)) break;
|
||||
ProcessReceivedPackets(e.BytesTransferred, e.Buffer);
|
||||
else
|
||||
break;
|
||||
if (checkForError(e)) break;
|
||||
|
||||
|
||||
} while (!socket.ReceiveAsync(e));
|
||||
} while (!socket.ReceiveAsync(e));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.ErrorPrint(ex.StackTrace);
|
||||
try { this.Disconnect(); } catch (Exception) { };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@ -102,8 +107,8 @@ namespace HISP.Server.Network
|
|||
socket = null;
|
||||
|
||||
}
|
||||
catch (SocketException e) { }
|
||||
catch (ObjectDisposedException e) { };
|
||||
catch (SocketException) { }
|
||||
catch (ObjectDisposedException) { };
|
||||
}
|
||||
|
||||
onDisconnectCallback();
|
||||
|
|
|
@ -350,7 +350,7 @@ namespace HISP.Server.Network
|
|||
additionalLengthData = BitConverter.GetBytes(Convert.ToUInt16(toSend)).Reverse().ToArray();
|
||||
|
||||
}
|
||||
else if(toSend < Int64.MaxValue)
|
||||
else if(Convert.ToInt64(toSend) < Int64.MaxValue)
|
||||
{
|
||||
maskAndLength |= WEBSOCKET_LENGTH_INT64;
|
||||
additionalLengthData = BitConverter.GetBytes(Convert.ToInt64(toSend)).Reverse().ToArray();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue