protected override void OnClosed() { base.OnClosed(); // clean up the CBT after transitioning to the closed state ChannelBindingUtility.Dispose(ref _channelBindingToken); }
protected override async Task OnCloseAsync(CancellationToken token) { TimeoutHelper timeoutHelper = new TimeoutHelper(TimeoutHelper.GetOriginalTimeout(token)); // send back EOF and then recycle the connection await Connection.WriteAsync(SingletonEncoder.EndBytes, 0, SingletonEncoder.EndBytes.Length, true, timeoutHelper.RemainingTime()); connectionDemuxer.ReuseConnection(rawConnection, timeoutHelper.RemainingTime()); ChannelBindingUtility.Dispose(ref channelBindingToken); }