예제 #1
0
        public async Task SendMessageAsync(Message.Message message)
        {
            if (!Session.IsTimedOut)
            {
                // execute outbound pipeline
                var writeRes = Session.Write(message);
                Session.Reset();
                if (Session.IsTimedOut)
                {
                    Close();
                    return;
                }

                // send bytes
                var bytes      = ConnectionHelper.ExtractBytes(writeRes);
                var senderEp   = ConnectionHelper.ExtractSenderEp(message);
                var receiverEp = ConnectionHelper.ExtractReceiverEp(message);
                await SendBytesAsync(bytes, senderEp, receiverEp);

                NotifyWriteCompleted();
            }
            else
            {
                Close();
            }
        }
예제 #2
0
 /// <summary>
 /// Results in having the next outbound handler write the provided message.
 /// </summary>
 /// <param name="msg"></param>
 public void FireWrite(object msg)
 {
     // forward to pipeline
     _session.Write(msg);
 }