Ejemplo n.º 1
0
 private void ToInitialize()
 {
     if (!mInitialized)
     {
         if (mAcceptSockets == null)
         {
             mAcceptSockets = new Dispatchs.Dispatcher <Socket>(AcceptProcess);
             mAcceptSockets.Start();
         }
         if (Config.ReceiveQueueEnabled)
         {
             mReceiveDispatchCenter = new Dispatchs.DispatchCenter <SocketAsyncEventArgsX>(ProcessReceiveArgs, Config.ReceiveQueues);
             mReceiveDispatchCenter.Start();
         }
         if (Config.SendQueueEnabled)
         {
             mSendDispatchCenter = new Dispatchs.DispatchCenter <ISession>(SessionSendData, Config.SendQueues);
             mSendDispatchCenter.Start();
         }
         mBufferPool        = new BufferPool(Config.BufferSize, 1024, IO_Completed);
         mReceiveBufferPool = new BufferPool(Config.BufferSize, 1024 * 10, IO_Completed);
         mSessions          = new Dictionary <long, ISession>(Config.MaxConnections * 2);
         mInitialized       = true;
         mWatch.Restart();
         mSessionDetector.Timeout = OnSessionDetection;
         mSessionDetector.Server  = this;
     }
 }