internal void OnOpen()
 {
     this.synchronizationContext    = ThreadBehavior.GetCurrentSynchronizationContext();
     this.innerNode.Offline        += new EventHandler(this.FireOffline);
     this.innerNode.Online         += new EventHandler(this.FireOnline);
     this.innerNode.EncodingElement = this.encoderElement;
 }
예제 #2
0
        public virtual IAsyncResult BeginFloodEncodedMessage(byte[] id, MessageBuffer encodedMessage, TimeSpan timeout, AsyncCallback callback, object state)
        {
            RecordOutgoingMessage(id);
            SynchronizationContext syncContext = ThreadBehavior.GetCurrentSynchronizationContext();

            SynchronizationContext.SetSynchronizationContext(null);

            if (neighbors.Count == 0)
            {
                return(new CompletedAsyncResult(callback, state));
            }
            try
            {
                return(FloodMessageToNeighbors(encodedMessage, timeout, callback, state, -1, null, null, OnMessageSentHandler));
            }
            finally
            {
                SynchronizationContext.SetSynchronizationContext(syncContext);
            }
        }