Inheritance: TransportMode
Exemplo n.º 1
0
 private void Init()
 {
     //TransportMode
     var protocolString = Config.GetString("transport-protocol");
     if (protocolString.Equals("tcp")) TransportMode = new Tcp();
     else if (protocolString.Equals("udp")) TransportMode = new Udp();
     else throw new ConfigurationException(string.Format("Unknown transport transport-protocol='{0}'", protocolString));
     EnableSsl = Config.GetBoolean("enable-ssl");
     ConnectTimeout = Config.GetTimeSpan("connection-timeout");
     WriteBufferHighWaterMark = OptionSize("write-buffer-high-water-mark");
     WriteBufferLowWaterMark = OptionSize("write-buffer-low-water-mark");
     SendBufferSize = OptionSize("send-buffer-size");
     ReceiveBufferSize = OptionSize("receive-buffer-size");
     var size = OptionSize("maximum-frame-size");
     if(size == null || size < 32000) throw new ConfigurationException("Setting 'maximum-frame-size' must be at least 32000 bytes");
     MaxFrameSize = (int)size;
     Backlog = Config.GetInt("backlog");
     TcpNoDelay = Config.GetBoolean("tcp-nodelay");
     TcpKeepAlive = Config.GetBoolean("tcp-keepalive");
     TcpReuseAddr = Config.GetBoolean("tcp-reuse-addr");
     var configHost = Config.GetString("hostname");
     var publicConfigHost = Config.GetString("public-hostname");
     Hostname = string.IsNullOrEmpty(configHost) ? IPAddress.Any.ToString() : configHost;
     PublicHostname = string.IsNullOrEmpty(publicConfigHost) ? configHost : publicConfigHost;
     ServerSocketWorkerPoolSize = ComputeWps(Config.GetConfig("server-socket-worker-pool"));
     ClientSocketWorkerPoolSize = ComputeWps(Config.GetConfig("client-socket-worker-pool"));
     Port = Config.GetInt("port");
 }
        private void Init()
        {
            //TransportMode
            var protocolString = Config.GetString("transport-protocol");

            if (protocolString.Equals("tcp"))
            {
                TransportMode = new Tcp();
            }
            else if (protocolString.Equals("udp"))
            {
                TransportMode = new Udp();
            }
            else
            {
                throw new ConfigurationException(string.Format("Unknown transport transport-protocol='{0}'", protocolString));
            }
            EnableSsl                = Config.GetBoolean("enable-ssl");
            ConnectTimeout           = Config.GetTimeSpan("connection-timeout");
            WriteBufferHighWaterMark = OptionSize("write-buffer-high-water-mark");
            WriteBufferLowWaterMark  = OptionSize("write-buffer-low-water-mark");
            SendBufferSize           = OptionSize("send-buffer-size");
            ReceiveBufferSize        = OptionSize("receive-buffer-size");
            var size = OptionSize("maximum-frame-size");

            if (size == null || size < 32000)
            {
                throw new ConfigurationException("Setting 'maximum-frame-size' must be at least 32000 bytes");
            }
            MaxFrameSize = (int)size;
            Backlog      = Config.GetInt("backlog");
            TcpNoDelay   = Config.GetBoolean("tcp-nodelay");
            TcpKeepAlive = Config.GetBoolean("tcp-keepalive");
            TcpReuseAddr = Config.GetBoolean("tcp-reuse-addr");
            var configHost       = Config.GetString("hostname");
            var publicConfigHost = Config.GetString("public-hostname");

            DnsUseIpv6                 = Config.GetBoolean("dns-use-ipv6");
            EnforceIpFamily            = RuntimeDetector.IsMono || Config.GetBoolean("enforce-ip-family");
            Hostname                   = string.IsNullOrEmpty(configHost) ? IPAddress.Any.ToString() : configHost;
            PublicHostname             = string.IsNullOrEmpty(publicConfigHost) ? Hostname : publicConfigHost;
            ServerSocketWorkerPoolSize = ComputeWps(Config.GetConfig("server-socket-worker-pool"));
            ClientSocketWorkerPoolSize = ComputeWps(Config.GetConfig("client-socket-worker-pool"));
            Port = Config.GetInt("port");

            // used to provide backwards compatibility with Helios 1.* clients
            BackwardsCompatibilityModeEnabled = Config.GetBoolean("enable-backwards-compatibility", false);
        }
Exemplo n.º 3
0
        private void Init()
        {
            //TransportMode
            var protocolString = Config.GetString("transport-protocol");

            if (protocolString.Equals("tcp"))
            {
                TransportMode = new Tcp();
            }
            else if (protocolString.Equals("udp"))
            {
                TransportMode = new Udp();
            }
            else
            {
                throw new ConfigurationException(string.Format("Unknown transport {0}", protocolString));
            }
            EnableSsl                = Config.GetBoolean("enable-ssl");
            ConnectTimeout           = Config.GetMillisDuration("connection-timeout");
            WriteBufferHighWaterMark = OptionSize("write-buffer-high-water-mark");
            WriteBufferLowWaterMark  = OptionSize("write-buffer-low-water-mark");
            SendBufferSize           = OptionSize("send-buffer-size");
            ReceiveBufferSize        = OptionSize("receive-buffer-size");
            var size = OptionSize("maximum-frame-size");

            if (size == null || size < 32000)
            {
                throw new ConfigurationException("Setting 'maximum-frame-size' must be at least 32000 bytes");
            }
            MaxFrameSize = (int)size;
            Backlog      = Config.GetInt("backlog");
            TcpNoDelay   = Config.GetBoolean("tcp-nodelay");
            TcpKeepAlive = Config.GetBoolean("tcp-keepalive");
            TcpReuseAddr = Config.GetBoolean("tcp-reuse-addr");
            var configHost       = Config.GetString("hostname");
            var publicConfigHost = Config.GetString("public-hostname");

            Hostname                   = string.IsNullOrEmpty(configHost) ? IPAddress.Any.ToString() : configHost;
            PublicHostname             = string.IsNullOrEmpty(publicConfigHost) ? configHost : publicConfigHost;
            ServerSocketWorkerPoolSize = ComputeWps(Config.GetConfig("server-socket-worker-pool"));
            ClientSocketWorkerPoolSize = ComputeWps(Config.GetConfig("client-socket-worker-pool"));
            Port = Config.GetInt("port");
        }