You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-17 07:36:32 +09:00
UnregisterReceivedCallback added
This commit is contained in:
@@ -56,6 +56,18 @@ namespace Lidgren.Network
|
|||||||
m_receiveCallbacks.Add(new NetTuple<SynchronizationContext, SendOrPostCallback>(SynchronizationContext.Current, callback));
|
m_receiveCallbacks.Add(new NetTuple<SynchronizationContext, SendOrPostCallback>(SynchronizationContext.Current, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call this to unregister a callback, but remember to do it in the same synchronization context!
|
||||||
|
/// </summary>
|
||||||
|
public void UnregisterReceivedCallback(SendOrPostCallback callback)
|
||||||
|
{
|
||||||
|
if (m_receiveCallbacks == null)
|
||||||
|
return;
|
||||||
|
m_receiveCallbacks.Remove(new NetTuple<SynchronizationContext, SendOrPostCallback>(SynchronizationContext.Current, callback));
|
||||||
|
if (m_receiveCallbacks.Count < 1)
|
||||||
|
m_receiveCallbacks = null;
|
||||||
|
}
|
||||||
|
|
||||||
internal void ReleaseMessage(NetIncomingMessage msg)
|
internal void ReleaseMessage(NetIncomingMessage msg)
|
||||||
{
|
{
|
||||||
NetException.Assert(msg.m_incomingMessageType != NetIncomingMessageType.Error);
|
NetException.Assert(msg.m_incomingMessageType != NetIncomingMessageType.Error);
|
||||||
|
|||||||
Reference in New Issue
Block a user