mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 20:25:51 +12:00
Fix build
This commit is contained in:
parent
458748e6b0
commit
7fcaf412df
5 changed files with 21 additions and 27 deletions
|
@ -5,7 +5,6 @@ namespace HISP.Server.Network
|
|||
{
|
||||
public class Hybrid : Transport
|
||||
{
|
||||
|
||||
Transport actualTransport = null;
|
||||
|
||||
|
||||
|
@ -58,29 +57,24 @@ namespace HISP.Server.Network
|
|||
|
||||
public override void ProcessReceivedPackets(int available, byte[] buffer)
|
||||
{
|
||||
for (int i = 0; i < available; i++)
|
||||
base.currentPacket.Add(buffer[i]);
|
||||
|
||||
if (currentPacket.Count >= 3)
|
||||
if (ConfigReader.EnableWebSocket && WebSocket.IsStartOfHandshake(buffer))
|
||||
{
|
||||
if (ConfigReader.EnableWebSocket && WebSocket.IsStartOfHandshake(currentPacket.ToArray()))
|
||||
{
|
||||
Logger.InfoPrint(this.Ip + " Switching to WebSocket");
|
||||
actualTransport = new WebSocket();
|
||||
Logger.InfoPrint(this.Ip + " Switching to WebSocket");
|
||||
actualTransport = new WebSocket();
|
||||
|
||||
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
|
||||
actualTransport.ProcessReceivedPackets(available, buffer);
|
||||
actualTransport.Accept(base.socket, base.onReceiveCallback, base.onDisconnectCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.InfoPrint(this.Ip + " Switching to XmlSocket");
|
||||
actualTransport = new XmlSocket();
|
||||
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
|
||||
actualTransport.ProcessReceivedPackets(available, buffer);
|
||||
actualTransport.Accept(base.socket, base.onReceiveCallback, base.onDisconnectCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.InfoPrint(this.Ip + " Switching to XmlSocket");
|
||||
actualTransport = new XmlSocket();
|
||||
|
||||
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
|
||||
actualTransport.ProcessReceivedPackets(available, buffer);
|
||||
actualTransport.Accept(base.socket, base.onReceiveCallback, base.onDisconnectCallback);
|
||||
}
|
||||
actualTransport.passObjects(this.socket, this.onReceiveCallback, this.onDisconnectCallback);
|
||||
actualTransport.ProcessReceivedPackets(available, buffer);
|
||||
actualTransport.Accept(base.socket, base.onReceiveCallback, base.onDisconnectCallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue