public async Task CloseAsyncAndAbort_NotFailing() { ICommunicationListener listener = CreateListener(addresses: "https://localhost:80"); await listener.CloseAsync(CancellationToken.None); listener.Abort(); }
private void _AbortListener( string ListenerName, ICommunicationListener listener) { this.statuses[ListenerName] = ICommunicationListenerStatus.Aborting; listener.Abort(); this.statuses[ListenerName] = ICommunicationListenerStatus.Aborted; this.traceWriter.TraceMessage(string.Format("Composite listener - listener {0} aborted", ListenerName)); }
public async Task RemoveListenerAsync(string Name) { ICommunicationListener listener = null; try { if (!this.listeners.ContainsKey(Name)) { throw new InvalidOperationException(string.Format("Listener with the name {0} does not exists", Name)); } listener = this.listeners[Name]; this.listenerLock.WaitOne(); await this._CloseListener(Name, listener, CancellationToken.None); } catch (AggregateException aex) { AggregateException ae = aex.Flatten(); this.traceWriter.TraceMessage( string.Format( "Compsite listen failed to close (for removal) listener:{0} it will be forcefully aborted E:{1} StackTrace:{2}", Name, ae.GetCombinedExceptionMessage(), ae.GetCombinedExceptionStackTrace())); // force abkrted if (null != listener) { try { listener.Abort(); } catch { /*no op*/ } } } finally { this.listeners.Remove(Name); this.statuses.Remove(Name); this.listenerLock.Set(); } }
public async Task RemoveListenerAsync(string Name) { ICommunicationListener listener = null; try { if (!this.listeners.ContainsKey(Name)) { throw new InvalidOperationException(string.Format("Listener with the name {0} does not exists", Name)); } listener = this.listeners[Name]; this.listenerLock.WaitOne(); await this._CloseListener(listener, CancellationToken.None); } catch (AggregateException aex) { AggregateException ae = aex.Flatten(); // force abkrted if (null != listener) { try { listener.Abort(); } catch { /*no op*/ } } } finally { this.listeners.Remove(Name); this.listenerLock.Set(); } }
/// <summary> /// This method causes the communication listener to close. Close is a terminal state and /// this method causes the transition to close ungracefully. Any outstanding operations /// (including close) should be canceled when this method is called. /// </summary> public void Abort() { _wrappedCommunicationListener.Abort(); }
private void _AbortListener( ICommunicationListener listener) { listener.Abort(); }
private void AbortListener( string listenerName, ICommunicationListener listener) { _statuses[listenerName] = CommunicationListenerStatus.Aborting; listener.Abort(); _statuses[listenerName] = CommunicationListenerStatus.Aborted; }