diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs index 8e7decf..25c128d 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs @@ -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