mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-02 14:01:50 +02:00
SMBServer: Release connections and associated resources when stopping the server
This commit is contained in:
parent
ed42b567e5
commit
5a29ef1556
2 changed files with 10 additions and 0 deletions
|
@ -44,6 +44,15 @@ namespace SMBLibrary.Server
|
|||
RemoveConnection(connection);
|
||||
}
|
||||
|
||||
public void ReleaseAllConnections()
|
||||
{
|
||||
List<ConnectionState> connections = new List<ConnectionState>(m_activeConnections);
|
||||
foreach (ConnectionState connection in connections)
|
||||
{
|
||||
ReleaseConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SessionInformation> GetSessionsInformation()
|
||||
{
|
||||
List<SessionInformation> result = new List<SessionInformation>();
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace SMBLibrary.Server
|
|||
Log(Severity.Information, "Stopping server");
|
||||
m_listening = false;
|
||||
SocketUtils.ReleaseSocket(m_listenerSocket);
|
||||
m_connectionManager.ReleaseAllConnections();
|
||||
}
|
||||
|
||||
// This method Accepts new connections
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue