예제 #1
0
        /// <summary>
        /// Creates the bootstrap instance
        /// </summary>
        ///
        /// <param name="maxConnections">
        /// The maximum amount of concurrent connections to handle
        /// </param>
        public ServerBootstrap(ChannelPipelineFactory pipelineFactory, int maxConnections = 1024)
        {
            //Ensure the pipeline is not null
            if (pipelineFactory == null)
            {
                Logger.Severe("Invalid pipeline factory specified!");
                Environment.Exit(0);
            }

            //Ensure a channel handler is set
            if (pipelineFactory.getPipeline().getHandler() == null)
            {
                Logger.Severe("Invalid channel handler specified!");
                Environment.Exit(0);
            }

            //Ensure an encoder is set
            if (pipelineFactory.getPipeline().getEncoder() == null)
            {
                Logger.Severe("Invalid encoder specified!");
                Environment.Exit(0);
            }

            //Ensure a decoder is set
            if (pipelineFactory.getPipeline().getDecoder() == null)
            {
                Logger.Severe("Invalid decoder specified!");
                Environment.Exit(0);
            }

            this.pipelineFactory = pipelineFactory;
            this.maxConnections  = maxConnections;
        }
예제 #2
0
        /// <summary>
        /// Creates a new worker instance
        /// </summary>
        ///
        /// <param name="pipelineFactory">
        /// The pipeline factory to use
        /// </param>
        ///
        /// <param name="socket">
        /// The socket to use
        /// </param>
        public BootstrapWorker(ChannelPipelineFactory pipelineFactory, Socket socket)
        {
            //Set the socket
            this.socket = socket;

            //Set the pipeline factory
            this.pipelineFactory = pipelineFactory;

            //Create the thread
            this.thread          = new Thread(new ThreadStart(pulse));
            this.thread.Name     = "SynapseWorker";
            this.thread.Priority = ThreadPriority.AboveNormal;

            //Start the thread
            this.running = true;
            this.thread.Start();
        }
예제 #3
0
 protected internal virtual ChannelPipelineFactory SetPipelineFactory()
 {
     this.pipelineFactory = new _ChannelPipelineFactory_53(this);
     return(this.pipelineFactory);
 }