Beispiel #1
0
        protected override IConnectFuture Connect0(EndPoint remoteEP, EndPoint localEP,
                                                   Action <IoSession, IConnectFuture> sessionInitializer)
        {
            endPoint = remoteEP as FileEndPoint;
            if (endPoint == null)
            {
                throw new ArgumentException("EndPoint must be FileEndPoint!");
            }
            IConnectFuture future  = new DefaultConnectFuture();
            var            session = new FileSession(this, endPoint);

            InitSession(session, future, sessionInitializer);

            try
            {
                session.Processor.Add(session);
            }
            catch (IOException ex)
            {
                return(DefaultConnectFuture.NewFailedFuture(ex));
            }

            idleStatusChecker.Start();

            return(future);
        }
Beispiel #2
0
 public FileSession(FileConnector service, FileEndPoint endPoint)
     : base(service)
 {
     base.Config    = service.SessionConfig;
     Processor      = service;
     RemoteEndPoint = endPoint;
     FilterChain    = new DefaultIoFilterChain(this);
 }