コード例 #1
0
        /// <summary>
        /// 释放资源
        /// </summary>
        public void Dispose()
        {
            if (Interlocked.CompareExchange(ref isDisposed, 1, 0) == 0)
            {
                server.Dispose();
                if (LocalDomainServer == null)
                {
                    FileWatcher.Dispose();

                    Monitor.Enter(domainLock);
                    DomainSearchData domains = this.domains;
                    this.domains = DomainSearchData.Default;
                    Monitor.Exit(domainLock);
                    domains.Close();
                    //domains.Dispose();

                    Monitor.Enter(hostLock);
                    try
                    {
                        foreach (Http.Server httpServer in hosts.Values)
                        {
                            httpServer.Dispose();
                        }
                        hosts.Clear();
                    }
                    finally { Monitor.Exit(hostLock); }
                }
                else
                {
                    LocalDomainServer.Dispose();
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     RemoveFileWatcher();
     if (HttpDomainServer != null)
     {
         HttpDomainServer.Dispose();
         HttpDomainServer = null;
     }
 }