private void ChannelAccepted(IAsyncResult result) { try { IReplyChannel replyChannel = _replyChannelListener.EndAcceptChannel(result); if (replyChannel != null) { try { replyChannel.Open(); replyChannel.BeginReceiveRequest(RequestAccepted, replyChannel); } catch (Exception e) { Console.WriteLine(e); replyChannel.Abort(); } if (_replyChannelListener.State == CommunicationState.Opened) { this._replyChannelListener.BeginAcceptChannel(ChannelAccepted, _replyChannelListener); } } } catch (Exception e) { Console.WriteLine(e); this._replyChannelListener.Abort(); this._replyChannelListener = null; } }
private void BasicChannelTestB(bool customBinding) { IChannelListener <IReplyChannel> listener = null; IReplyChannel channel = null; ManualResetEvent done = new ManualResetEvent(false); Thread t = null; try { channel = this.OpenChannel(customBinding, out listener); Assert.IsNotNull(channel); Assert.IsNotNull(listener); t = new Thread(BasicChannelTests.SubmitRequests); t.Start(done); for (var cnt = 0; cnt < TestServiceCommon.Iterations; cnt++) { RequestContext context; if (channel.TryReceiveRequest(TestServiceCommon.DefaultHostTimeout, out context)) { this.SendResponse(context); } else { Assert.Fail("TryReceiveRequest failed."); } } channel.Close(TestServiceCommon.DefaultHostTimeout); listener.Close(TestServiceCommon.DefaultHostTimeout); } catch (Exception e) { channel.Abort(); listener.Abort(); Assert.Fail("Unexpected exception: " + e); } finally { if (t != null && !done.WaitOne(TestServiceCommon.DefaultHostTimeout)) { t.Abort(); } done.Dispose(); } }
private void RequestAccepted(IAsyncResult result) { IReplyChannel replyChannel = (IReplyChannel)result.AsyncState; try { var requestContext = replyChannel.EndReceiveRequest(result); if (requestContext != null) { var context = new AzureServiceBusHttpContext(requestContext); context.Items["ReplyChannel"] = replyChannel; ProcessRequest(context); } } catch (Exception exc) { Manager.Log("Request Accepted: " + exc.Message, "Proxy"); replyChannel.Abort(); } }
public void Abort() { _channel.Abort(); }
protected override void OnAbort() { inner.Abort(); }
public void Abort() { _innerChannel.Abort(); }