internal TcpSocketSaeaFullBased(
     TcpSocketConfigurationBase configuration,
     SaeaAwaiterPool handlerSaeaPool,
     SessionPool sessionPool,
     NotifyEventHandler <TcpSessionNotify, TcpSocketSaeaSession> notifyEventHandler,
     TcpSocketSaeaEngineBased agent)
     : base(notifyEventHandler, configuration, handlerSaeaPool, sessionPool, agent)
     => CompletedBuffer = new byte[configuration.ReceiveBufferSize];
示例#2
0
 internal TcpSocketSaeaPackBased(
     TcpSocketConfigurationBase configuration,
     SaeaAwaiterPool handlerSaeaPool,
     SessionPool sessionPool,
     NotifyEventHandler <TcpSocketCompletionNotify, TcpSocketSaeaSession> notifyEventHandler,
     TcpSocketSaeaEngineBased agent)
     : base(notifyEventHandler, configuration, handlerSaeaPool, sessionPool, agent)
 {
     _isCompress = configuration.CompressTransferFromPacket;
 }
 internal TcpSocketSaeaSession(
     NotifyEventHandler <TcpSocketCompletionNotify, TcpSocketSaeaSession> notifyEventHandler,
     TcpSocketConfigurationBase configuration,
     SaeaAwaiterPool handlerSaeaPool,
     SessionPool sessionPool,
     TcpSocketSaeaEngineBased agent)
 {
     NotifyEventHandler = notifyEventHandler;
     Configuration      = configuration;
     HandlerSaeaPool    = handlerSaeaPool;
     SessionPools       = sessionPool;
     Agent = agent;
 }
示例#4
0
 internal TcpSocketSaeaSession(
     NotifyEventHandler <TcpSocketCompletionNotify, TcpSocketSaeaSession> notifyEventHandler,
     TcpSocketConfigurationBase configuration,
     SaeaAwaiterPool handlerSaeaPool,
     SessionPool sessionPool,
     TcpSocketSaeaEngineBased agent,
     LogHelper logHelper)
 {
     _notifyEventHandler = notifyEventHandler;
     _configuration      = configuration;
     _handlerSaeaPool    = handlerSaeaPool;
     _sessionPool        = sessionPool;
     _agent  = agent;
     _logger = logHelper;
 }
示例#5
0
        internal TcpSocketSaeaEngineBased(
            TcpSocketSaeaSessionType saeaSessionType,
            TcpSocketConfigurationBase configuration,
            NotifyEventHandler <TcpSessionNotify, TcpSocketSaeaSession> completetionNotify)
        {
            TcpSocketSaeaSessions = new List <TcpSocketSaeaSession>();
            HandlerSaeaPool       = new SaeaAwaiterPool();
            SessionPool           = new SessionPool();

            SaeaSessionType    = saeaSessionType;
            Configuration      = configuration;
            CompletetionNotify = completetionNotify;

            HandlerSaeaPool.Initialize(() => new SaeaAwaiter(),
                                       (saea) =>
            {
                try
                {
                    saea.Saea.AcceptSocket = null;
                    saea.Saea.SetBuffer(EmptyArray, 0, EmptyArray.Length);
                    saea.Saea.RemoteEndPoint = null;
                    saea.Saea.SocketFlags    = SocketFlags.None;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("server_clean awaiter info:" + ex.Message);
                }
            },
                                       50);
            if (saeaSessionType == TcpSocketSaeaSessionType.Full)
            {
                SessionPool.Initialize(() => new TcpSocketSaeaFullBased(Configuration, HandlerSaeaPool, SessionPool, completetionNotify, this),
                                       (session) =>
                {
                    session.Detach();
                }, 50);
            }
            else
            {
                SessionPool.Initialize(() => new TcpSocketSaeaPackBased(Configuration, HandlerSaeaPool, SessionPool, completetionNotify, this),
                                       (session) =>
                {
                    session.Detach();
                }, 50);
            }
        }