/// <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(); }
/// <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; }
/// <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(); }
/// <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; }
/// <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(); }
/// <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(); }