public void InvokeReceiveIfNotNull(NetworkData data) { if (NetworkEventLoop.Receive != null) { NetworkEventLoop.Receive(data, this); } }
public void BeginReceive(ReceivedDataCallback callback) { Receive += callback; foreach (var msg in UnreadMessages.DequeueAll()) { NetworkEventLoop.Receive(msg, this); } BeginReceiveInternal(); }
/// <summary> /// Method is called directly by the <see cref="ReactorBase" /> implementation to send data to this /// <see cref="IConnection" />. /// Can also be called by the socket itself if this reactor doesn't use <see cref="ReactorProxyResponseChannel" />. /// </summary> /// <param name="data">The data to pass directly to the recipient</param> internal virtual void OnReceive(NetworkData data) { if (NetworkEventLoop.Receive != null) { NetworkEventLoop.Receive(data, this); } else { UnreadMessages.Enqueue(data); } }