bool TransparentStreamCloseRequestMessageReceived(TransparentStreamMessageBase transparentStreamMessageBase) { TransparentStreamCloseRequestMessage request = (TransparentStreamCloseRequestMessage)transparentStreamMessageBase; Exception exception = null; try { baseStream.Close(); } catch (Exception ex) { exception = ex; } objectBusSession.SendMessage(new TransparentStreamCloseResponseMessage(streamID, request.ID, exception)); return(exception == null); }
public IAsyncResult BeginClose () { TransparentStreamCloseRequestMessage request = new TransparentStreamCloseRequestMessage (Guid.NewGuid (), streamID); TransparentStreamAsyncResult result = new TransparentStreamAsyncResult (null); if (!pendingCloseRequests.TryAdd (request.ID, result)) { throw new Exception ("request failed before sending."); } objectBusSession.SendMessage (request); return result; }