/// <summary> /// Start the listener /// </summary> public virtual void Start() { if (m_IsNeedAttach) { // Attach the listen to the listener manager, now the manager will take in control of this listener FtpListenerManager.AddListener(this); } FtpListenerManager.GetFtpManager().Start(); m_IsRunning = true; }
/// <summary> /// Stop the listener /// </summary> public virtual void Stop() { m_IsRunning = false; if (m_IsNeedAttach) { while (m_ContextQueue.Count > 0) { // get all pending contexts and send them back to the listener manager // the manager will add these context to some other listener's context queue m_ContextQueue.Dequeue(); FtpListenerManager.GetFtpManager().AddContext(m_ContextQueue.Dequeue() as FtpListenerContext); } FtpListenerManager.RemoveListener(this); } }