/// <summary>
        /// Starts SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Start()
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if (m_IsRunning)
            {
                return;
            }
            m_IsRunning = true;

            m_pLocalEndPointIPv4 = new CircleCollection <IPBindInfo>();
            m_pLocalEndPointIPv6 = new CircleCollection <IPBindInfo>();
            m_pSessions          = new TCP_SessionCollection <Relay_Session>();
            m_pConnectionsPerIP  = new Dictionary <IPAddress, long>();

            Thread tr1 = new Thread(new ThreadStart(this.Run));

            tr1.Start();

            m_pTimerTimeout          = new TimerEx(30000);
            m_pTimerTimeout.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerTimeout_Elapsed);
            m_pTimerTimeout.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Stops SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Stop()
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }
            if (!m_IsRunning)
            {
                return;
            }
            m_IsRunning = false;

            // TODO: We need to send notify to all not processed messages, then they can be Disposed as needed.

            // Clean up.
            m_pLocalEndPoints = null;
            //m_pSessions.Dispose();
            m_pSessions         = null;
            m_pConnectionsPerIP = null;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Start()
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }
            if (m_IsRunning)
            {
                return;
            }
            m_IsRunning = true;

            m_pLocalEndPoints   = new CircleCollection <IPBindInfo>();
            m_pSessions         = new TCP_SessionCollection <Relay_Session>();
            m_pConnectionsPerIP = new Dictionary <IPAddress, long>();

            Thread tr1 = new Thread(Run);

            tr1.Start();

            Thread tr2 = new Thread(Run_CheckTimedOutSessions);

            tr2.Start();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Stops SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Stop()
        {
            if(m_IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(!m_IsRunning){
                return;
            }
            m_IsRunning = false;

            // TODO: We need to send notify to all not processed messages, then they can be Disposed as needed.
                        
            // Clean up.            
            m_pLocalEndPointIPv4 = null;
            m_pLocalEndPointIPv6 = null;
            //m_pSessions.Dispose();
            m_pSessions = null;
            m_pConnectionsPerIP = null;
            m_pTimerTimeout.Dispose();
            m_pTimerTimeout = null;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Starts SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Start()
        {
            if(m_IsDisposed){
                throw new ObjectDisposedException(this.GetType().Name);
            }
            if(m_IsRunning){
                return;
            }
            m_IsRunning = true;

            m_pLocalEndPointIPv4 = new CircleCollection<IPBindInfo>();
            m_pLocalEndPointIPv6 = new CircleCollection<IPBindInfo>();
            m_pSessions          = new TCP_SessionCollection<Relay_Session>();
            m_pConnectionsPerIP  = new Dictionary<IPAddress,long>();

            Thread tr1 = new Thread(new ThreadStart(this.Run));
            tr1.Start();

            m_pTimerTimeout = new TimerEx(30000);
            m_pTimerTimeout.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimerTimeout_Elapsed);
            m_pTimerTimeout.Start();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Starts SMTP relay server.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Is raised when this object is disposed and this method is accessed.</exception>
        public virtual void Start()
        {
            if (m_IsDisposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }
            if (m_IsRunning)
            {
                return;
            }
            m_IsRunning = true;

            m_pLocalEndPoints = new CircleCollection<IPBindInfo>();
            m_pSessions = new TCP_SessionCollection<Relay_Session>();
            m_pConnectionsPerIP = new Dictionary<IPAddress, long>();

            Thread tr1 = new Thread(Run);
            tr1.Start();

            Thread tr2 = new Thread(Run_CheckTimedOutSessions);
            tr2.Start();
        }