Skip to content

Commit

Permalink
Do not call End/Abort on disconnect #430 (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Oct 25, 2021
1 parent 412e649 commit cc2ae7e
Showing 1 changed file with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,7 @@ internal void End(Exception ex)
{
if (ex != null)
{
// TODO: LOG
// Lazy initialized
if (_cts != null)
{
try
{
_cts.Cancel();
}
catch (ObjectDisposedException)
{
}
catch (AggregateException)
{
// TODO: LOG
}
}
CancelDisconnectToken();
}

End();
Expand All @@ -99,7 +84,26 @@ internal void End()
private static void SetDisconnected(object state)
{
var context = (OwinHttpListenerContext)state;
context.End(new HttpListenerException(Constants.ErrorConnectionNoLongerValid));
context.CancelDisconnectToken();
}

private void CancelDisconnectToken()
{
// Lazy initialized
if (_cts != null)
{
try
{
_cts.Cancel();
}
catch (ObjectDisposedException)
{
}
catch (AggregateException)
{
// TODO: LOG
}
}
}

public void Dispose()
Expand Down

0 comments on commit cc2ae7e

Please sign in to comment.