public void Stop() { _shutdownInProgress = true; try { if (_mongrel2Connection != null) { _mongrel2Connection.Dispose(); } } catch { } finally { _mongrel2Connection = null; } try { if (_host != null) { _host.Shutdown(); } while (_host != null) { Thread.Sleep(100); } } catch { } finally { _host = null; } }
/// <summary> /// This takes ownership of the mongrel2Connection. It will be disposed when the server is stopped /// and the connection should probably not be reused anyways due to the threading issue with /// ZMQ. /// </summary> /// <param name="mongrel2Connection"></param> /// <param name="virtualPath"></param> /// <param name="physicalPath"></param> public Server(m2net.Connection mongrel2Connection, string virtualPath, string physicalPath) { _mongrel2Connection = mongrel2Connection; _virtualPath = virtualPath; _physicalPath = physicalPath[physicalPath.Length - 1] == Path.DirectorySeparatorChar ? physicalPath : physicalPath + Path.DirectorySeparatorChar; }