Clean up on socket initialization error

This commit is contained in:
Boris Bendovsky 2017-04-25 09:02:06 +03:00
parent fd6cdce95c
commit 624d1d215c

View file

@ -240,6 +240,20 @@ namespace AsterNET.FastAGI
#endif
throw ex;
}
finally
{
if (serverSocket != null)
{
serverSocket.Close();
serverSocket = null;
}
pool.Shutdown();
#if LOGGER
logger.Info("AGIServer shut down.");
#endif
}
#if LOGGER
logger.Info("Listening on " + address + ":" + port + ".");
#endif