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(); } }
/// <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); }