SMBServer: Release connections and associated resources when stopping the server

This commit is contained in:
Tal Aloni 2017-07-27 10:39:31 +03:00
parent ed42b567e5
commit 5a29ef1556
2 changed files with 10 additions and 0 deletions

View file

@ -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>();

View file

@ -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