private void InitArgsPool()
 {
     _argsPool = new SaeaAwaitablePool();
     _argsPool.SetInitPoolSize(512);
     _argsPool.SetMaxPoolSize(MAX_HANDLER_NUM);
     _argsPool.SetEachBufSize(RecvSize);
     _argsPool.FinishConfig();
 }
示例#2
0
 private void InitArgsPool()
 {
     _argsPool = new SaeaAwaitablePool();
     _argsPool.SetInitPoolSize(128);
     _argsPool.SetMaxPoolSize(UDP_HANDLER_NUM);
     _argsPool.SetEachBufSize(UDPPacketLen);
     _argsPool.FinishConfig();
 }
示例#3
0
 public UDPHandler(Socket local, Server server, EndPoint localEndPoint, SaeaAwaitablePool pool)
 {
     _localSocket    = local;
     _server         = server;
     _localEndPoint  = localEndPoint;
     _argsPool       = pool;
     _serverEndPoint = SocketUtil.GetEndPoint(server.server, server.server_port);
     _serverSocket   = new Socket(SocketType.Dgram, ProtocolType.Udp);
 }
示例#4
0
 public UDPHandler(Socket local, Server server, EndPoint localEndPoint, SaeaAwaitablePool pool)
 {
     _local          = local;
     _server         = server;
     _localEndPoint  = localEndPoint;
     _argsPool       = pool;
     _remoteEndPoint = SocketUtil.GetEndPoint(server.server, server.server_port);
     _remote         = new Socket(_remoteEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
 }
示例#5
0
        public TCPHandler(FuckshadowsController controller, Configuration config, TCPRelay tcprelay, Socket socket)
        {
            _controller  = controller;
            _config      = config;
            _tcprelay    = tcprelay;
            _localSocket = socket;
            _argsPool    = tcprelay._argsPool;

            lastActivity = DateTime.Now;
        }
示例#6
0
        private void InitArgsPool()
        {
            //accept args pool don't need buffer
            _acceptArgsPool = new SaeaAwaitablePool();
            _acceptArgsPool.SetInitPoolSize(256);
            _acceptArgsPool.SetMaxPoolSize(BACKLOG);
            _acceptArgsPool.SetNoSetBuffer();
            _acceptArgsPool.FinishConfig();

            // first packet handling pool
            _argsPool = new SaeaAwaitablePool();
            _argsPool.SetInitPoolSize(256);
            _argsPool.SetMaxPoolSize(TCPRelay.MAX_HANDLER_NUM);
            _argsPool.SetEachBufSize(MaxFirstPacketLen);
            _argsPool.FinishConfig();
        }
            public void Start(byte[] firstPacket, int length, Socket socket, int targetPort, SaeaAwaitablePool pool)
            {
                _firstPacket       = firstPacket;
                _firstPacketLength = length;
                _local             = socket;
                _argsPool          = pool;

                Interlocked.Exchange(ref _state, _running);

                try
                {
                    // Connect to the remote endpoint.
                    _remote = new Socket(SocketType.Stream, ProtocolType.Tcp);
                    _remote.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true);

                    Task.Factory.StartNew(async() => { await StartConnect(targetPort); },
                                          TaskCreationOptions.PreferFairness);
                }
                catch (Exception e)
                {
                    Logging.LogUsefulException(e);
                    Close();
                }
            }
示例#8
0
 private void InitArgsPool()
 {
     _argsPool = SaeaAwaitablePoolManager.GetOrdinaryInstance();
 }