Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2ef761bd7 | |||
| 828112855f |
@@ -21,7 +21,7 @@ namespace Ragon.Core
|
|||||||
public int MaxRooms;
|
public int MaxRooms;
|
||||||
|
|
||||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
private static readonly string _serverVersion = "1.0.26-rc";
|
private static readonly string _serverVersion = "1.0.27-rc";
|
||||||
|
|
||||||
private static void CopyrightInfo()
|
private static void CopyrightInfo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ namespace Ragon.Core
|
|||||||
|
|
||||||
public void Start(ushort port, int connections, uint protocol)
|
public void Start(ushort port, int connections, uint protocol)
|
||||||
{
|
{
|
||||||
|
Library.Initialize();
|
||||||
|
|
||||||
_address = default;
|
_address = default;
|
||||||
_address.Port = port;
|
_address.Port = port;
|
||||||
_peers = new Peer[connections];
|
_peers = new Peer[connections];
|
||||||
@@ -146,6 +148,8 @@ namespace Ragon.Core
|
|||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
_host?.Dispose();
|
_host?.Dispose();
|
||||||
|
|
||||||
|
Library.Deinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsValidProtocol(uint protocol)
|
private bool IsValidProtocol(uint protocol)
|
||||||
|
|||||||
@@ -74,9 +74,16 @@ public class WebSocketServer : ISocketServer
|
|||||||
while (_events.TryDequeue(out var evnt))
|
while (_events.TryDequeue(out var evnt))
|
||||||
{
|
{
|
||||||
if (_webSockets.TryGetValue(evnt.PeerId, out var ws) && ws.State == WebSocketState.Open)
|
if (_webSockets.TryGetValue(evnt.PeerId, out var ws) && ws.State == WebSocketState.Open)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await ws.SendAsync(evnt.Data, WebSocketMessageType.Binary, WebSocketMessageFlags.EndOfMessage, CancellationToken.None);
|
await ws.SendAsync(evnt.Data, WebSocketMessageType.Binary, WebSocketMessageFlags.EndOfMessage, CancellationToken.None);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.Error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user