Exemplo n.º 1
0
        public Connection(IServer server, IConnectionChannel connectionChannel, IVerbMap verbMap)
        {
            ConnectionChannel = connectionChannel;
            VerbMap           = verbMap;
            Session           = server.Behaviour.OnCreateNewSession(this, ConnectionChannel.ClientIPAddress, DateTime.Now);

            Server = server;

            ConnectionChannel.ReceiveTimeout = Server.Behaviour.GetReceiveTimeout(this);
            SetReaderEncodingToDefault();

            ExtensionProcessors = Server.Behaviour.GetExtensions(this).Select(e => e.CreateExtensionProcessor(this)).ToArray();
        }
Exemplo n.º 2
0
        public Connection(IServer server, IConnectionChannel connectionChannel, IVerbMap verbMap)
        {
            ConnectionChannel = connectionChannel;
            VerbMap = verbMap;
            Session = server.Behaviour.OnCreateNewSession(this, ConnectionChannel.ClientIPAddress, DateTime.Now);

            Server = server;

            ConnectionChannel.ReceiveTimeout = Server.Behaviour.GetReceiveTimeout(this);
            SetReaderEncodingToDefault();

            ExtensionProcessors = Server.Behaviour.GetExtensions(this).Select(e => e.CreateExtensionProcessor(this)).ToArray();
        }
Exemplo n.º 3
0
        public Connection(IServer server, IConnectionChannel connectionChannel, IVerbMap verbMap)
        {
            _id = string.Format("[RemoteIP={0}]", connectionChannel.ClientIPAddress.ToString());

            ConnectionChannel         = connectionChannel;
            ConnectionChannel.Closed += OnConnectionChannelClosed;

            VerbMap = verbMap;
            Session = server.Behaviour.OnCreateNewSession(this, ConnectionChannel.ClientIPAddress, DateTime.Now);

            Server = server;

            ConnectionChannel.ReceiveTimeout = Server.Behaviour.GetReceiveTimeout(this);
            ConnectionChannel.SendTimeout    = Server.Behaviour.GetSendTimeout(this);
            SetReaderEncodingToDefault();

            ExtensionProcessors = Server.Behaviour.GetExtensions(this).Select(e => e.CreateExtensionProcessor(this)).ToArray();
        }
Exemplo n.º 4
0
        public Connection(IServer server, IConnectionChannel connectionChannel, IVerbMap verbMap)
        {
            _id = string.Format("[RemoteIP={0}]", connectionChannel.ClientIPAddress.ToString());

            ConnectionChannel = connectionChannel;
            ConnectionChannel.Closed += OnConnectionChannelClosed;

            VerbMap = verbMap;
            Session = server.Behaviour.OnCreateNewSession(this, ConnectionChannel.ClientIPAddress, DateTime.Now);

            Server = server;

            ConnectionChannel.ReceiveTimeout = Server.Behaviour.GetReceiveTimeout(this);
            ConnectionChannel.SendTimeout = Server.Behaviour.GetSendTimeout(this);
            SetReaderEncodingToDefault();

            ExtensionProcessors = Server.Behaviour.GetExtensions(this).Select(e => e.CreateExtensionProcessor(this)).ToArray();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VerbWithSubCommands"/> class.
 /// </summary>
 /// <param name="subVerbMap">The subVerbMap<see cref="IVerbMap"/>.</param>
 protected VerbWithSubCommands(IVerbMap subVerbMap)
 {
     this.SubVerbMap = subVerbMap;
 }
Exemplo n.º 6
0
 protected VerbWithSubCommands(IVerbMap subVerbMap)
 {
     SubVerbMap = subVerbMap;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Connection"/> class.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="session">The session.</param>
        /// <param name="connectionChannel">The connection channel.</param>
        /// <param name="verbMap">The verb map.</param>
        /// <param name="extensionProcessors">The extension processors.</param>
        internal Connection(ISmtpServer server, IEditableSession session, IConnectionChannel connectionChannel, IVerbMap verbMap, Func <IConnection, IExtensionProcessor[]> extensionProcessors)
        {
            this.id = $"[RemoteIP={connectionChannel.ClientIPAddress}]";

            this.ConnectionChannel = connectionChannel;
            this.ConnectionChannel.ClosedEventHandler += this.OnConnectionChannelClosed;

            this.VerbMap             = verbMap;
            this.Session             = session;
            this.Server              = server;
            this.ExtensionProcessors = extensionProcessors(this).ToArray();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates the a connection for the specified server and channel..
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="connectionChannel">The connection channel.</param>
        /// <param name="verbMap">The verb map.</param>
        /// <returns>An <see cref="Task{T}"/> representing the async operation.</returns>
        internal static async Task <Connection> Create(ISmtpServer server, IConnectionChannel connectionChannel, IVerbMap verbMap)
        {
            IEditableSession session = await server.Behaviour.OnCreateNewSession(connectionChannel).ConfigureAwait(false);

            var extensions = await server.Behaviour.GetExtensions(connectionChannel).ConfigureAwait(false);

            IExtensionProcessor[] CreateConnectionExtensions(IConnection c) => extensions.Select(e => e.CreateExtensionProcessor(c)).ToArray();

            Connection result = new Connection(server, session, connectionChannel, verbMap, CreateConnectionExtensions);

            return(result);
        }