예제 #1
0
        /// <summary>
        /// 启动TCP服务
        /// </summary>
        /// <param name="domain">域名信息</param>
        /// <returns>HTTP服务启动状态</returns>
        private RegisterState startSsl(Domain domain)
        {
            RegisterState state = RegisterState.TcpError;

            Http.Server httpServer = null;
            Monitor.Enter(hostLock);
            try
            {
                if (hosts.TryGetValue(domain.SslHost, out httpServer))
                {
                    if (httpServer.IsSSL)
                    {
                        if (new AutoCSer.Net.Http.UnionType {
                            Value = httpServer
                        }.SslServer.SetCertificate(domain))
                        {
                            ++httpServer.DomainCount;
                            return(RegisterState.Success);
                        }
                        state = RegisterState.CertificateError;
                    }
                    else
                    {
                        state = RegisterState.SslMatchError;
                    }
                    httpServer = null;
                }
                else
                {
                    state = RegisterState.CreateServerError;
                    Http.SslServer server = new Http.SslServer(this, domain);
                    httpServer = server;
                    if (server.IsCertificate)
                    {
                        if (httpServer.IsStart)
                        {
                            hosts.Add(domain.SslHost, httpServer);
                            return(RegisterState.Success);
                        }
                    }
                    else
                    {
                        state = RegisterState.CertificateError;
                    }
                }
            }
            catch (Exception error)
            {
                server.Log.Add(AutoCSer.Log.LogType.Error, error);
            }
            finally { Monitor.Exit(hostLock); }
            if (httpServer != null)
            {
                httpServer.Dispose();
            }
            return(state);
        }
예제 #2
0
        public BaseProcedureSet(string suburl, Http.Server server, BakjeProtocol.Auth.BaseAuthServer authServer, SQL.SQLHelper sqlhelper)
        {
            procedurePool = new ServerProcedurePool();
            procedurePool.SetBridge(server.CreateProcedurePoolBridge(suburl));
            procedurePool.SetAuthServerObj(authServer);

            sqlHelper       = sqlhelper;
            this.authServer = authServer;

            Initialize();

            procedurePool.Start();
        }
예제 #3
0
        /// <summary>
        /// 启动TCP服务
        /// </summary>
        /// <param name="host">TCP服务端口信息</param>
        /// <returns>HTTP服务启动状态</returns>
        private RegisterState start(ref HostPort host)
        {
            RegisterState state = RegisterState.TcpError;

            Http.Server httpServer = null;
            Monitor.Enter(hostLock);
            try
            {
                if (hosts.TryGetValue(host, out httpServer))
                {
                    if (!httpServer.IsSSL)
                    {
                        ++httpServer.DomainCount;
                        return(RegisterState.Success);
                    }
                    httpServer = null;
                    state      = RegisterState.SslMatchError;
                }
                else
                {
                    state      = RegisterState.CreateServerError;
                    httpServer = new Http.Server(this, ref host, false);
                    if (httpServer.IsStart)
                    {
                        hosts.Add(host, httpServer);
                        return(RegisterState.Success);
                    }
                }
            }
            catch (Exception error)
            {
                server.Log.Add(AutoCSer.Log.LogType.Error, error);
            }
            finally { Monitor.Exit(hostLock); }
            if (httpServer != null)
            {
                httpServer.Dispose();
            }
            return(state);
        }