mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
basic result checking. dont parse further than non-ok
This commit is contained in:
parent
d711202dae
commit
bcf3f8e32d
@ -75,7 +75,10 @@ public class Client
|
||||
fixed (byte* pData = segment.Array)
|
||||
{
|
||||
var result = SteamNetworkingSockets.SendMessageToConnection(_conn, (IntPtr)(pData + segment.Offset), (uint)segment.Count, Util.MirrorChannel2SendFlag(channelId), out _);
|
||||
_transport.OnClientDataSent?.Invoke(segment, channelId);
|
||||
if (result == EResult.k_EResultOK)
|
||||
_transport.OnClientDataSent?.Invoke(segment, channelId);
|
||||
else
|
||||
_transport.OnClientError?.Invoke(TransportError.InvalidSend, $"send returned {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,6 +103,8 @@ public class Client
|
||||
public void Flush()
|
||||
{
|
||||
var result = SteamNetworkingSockets.FlushMessagesOnConnection(_conn);
|
||||
if (result != EResult.k_EResultOK)
|
||||
_transport.OnClientError?.Invoke(TransportError.Unexpected, $"flush returned {result}");
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
@ -69,7 +69,10 @@ public class Server
|
||||
fixed (byte* pData = segment.Array)
|
||||
{
|
||||
var result = SteamNetworkingSockets.SendMessageToConnection(conn, (IntPtr)(pData + segment.Offset), (uint)segment.Count, Util.MirrorChannel2SendFlag(channelId), out _);
|
||||
_transport.OnServerDataSent?.Invoke(connectionId, segment, channelId);
|
||||
if (result == EResult.k_EResultOK)
|
||||
_transport.OnServerDataSent?.Invoke(connectionId, segment, channelId);
|
||||
else
|
||||
_transport.OnServerError?.Invoke(connectionId, TransportError.InvalidSend, $"send returned {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,6 +103,8 @@ public class Server
|
||||
foreach (var conn in _conns)
|
||||
{
|
||||
var result = SteamNetworkingSockets.FlushMessagesOnConnection(conn);
|
||||
if (result != EResult.k_EResultOK)
|
||||
_transport.OnServerError?.Invoke((int)conn.m_HSteamNetConnection, TransportError.Unexpected, $"flush returned {result}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user