Skip to content

Commit cc2ae7e

Browse files
authored
Do not call End/Abort on disconnect #430 (#432)
1 parent 412e649 commit cc2ae7e

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

src/Microsoft.Owin.Host.HttpListener/RequestProcessing/OwinHttpListenerContext.cs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,7 @@ internal void End(Exception ex)
6262
{
6363
if (ex != null)
6464
{
65-
// TODO: LOG
66-
// Lazy initialized
67-
if (_cts != null)
68-
{
69-
try
70-
{
71-
_cts.Cancel();
72-
}
73-
catch (ObjectDisposedException)
74-
{
75-
}
76-
catch (AggregateException)
77-
{
78-
// TODO: LOG
79-
}
80-
}
65+
CancelDisconnectToken();
8166
}
8267

8368
End();
@@ -99,7 +84,26 @@ internal void End()
9984
private static void SetDisconnected(object state)
10085
{
10186
var context = (OwinHttpListenerContext)state;
102-
context.End(new HttpListenerException(Constants.ErrorConnectionNoLongerValid));
87+
context.CancelDisconnectToken();
88+
}
89+
90+
private void CancelDisconnectToken()
91+
{
92+
// Lazy initialized
93+
if (_cts != null)
94+
{
95+
try
96+
{
97+
_cts.Cancel();
98+
}
99+
catch (ObjectDisposedException)
100+
{
101+
}
102+
catch (AggregateException)
103+
{
104+
// TODO: LOG
105+
}
106+
}
103107
}
104108

105109
public void Dispose()

0 commit comments

Comments
 (0)