Made the listeners disposable · bonesoul/uhttpsharp@5f19754 · GitHub
Skip to content

Commit 5f19754

Browse files
committed
Made the listeners disposable
1 parent 51e8d7b commit 5f19754

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎uhttpsharp/Listeners/IHttpListener.cs‎

Lines changed: 3 additions & 2 deletions

uhttpsharp/Listeners/SslListenerDecoerator.cs renamed to uhttpsharp/Listeners/SslListenerDecorator.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public ListenerSslDecorator(IHttpListener child, X509Certificate certificate)
1818
public async Task<IClient> GetClient()
1919
{
2020
return new ClientSslDecorator(await _child.GetClient().ConfigureAwait(false), _certificate);
21+
}
22+
23+
public void Dispose()
24+
{
25+
_child.Dispose();
2126
}
2227
}
2328
}

‎uhttpsharp/Listeners/TcpListenerAdapter.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,10 @@ public async Task<IClient> GetClient()
1717
{
1818
return new TcpClientAdapter(await _listener.AcceptTcpClientAsync().ConfigureAwait(false));
1919
}
20+
21+
public void Dispose()
22+
{
23+
_listener.Stop();
24+
}
2025
}
2126
}

‎uhttpsharp/uhttpsharp.csproj‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)