public IAsyncResult BeginDispatch(TimeSpan timeout, IMessage msg, object state, AsyncCallback callback) { var r = new GenericAsyncResult(state) { Callback = callback, UniqueIdentifier = msg.UniqueIdentifier }; _syncro.WaitOne(); _activeMessages.Add(msg.UniqueIdentifier, r); _syncro.Set(); SentMessages.Inc(1); var obuff = GZip.SerializeAndCompress(msg); SentBytes.Inc((ulong)obuff.GetLength(0)); _outChannel.Send(obuff); return(r); }