protected override void InvokeOnClientConnected(SessionEventArgs ea) { ((VirtualFtpSession)ea.Session).CurrentFolder = fRootFolder; if (fUserManager == null) return; if (!fUserManager.CheckIP(ea.Connection.RemoteEndPoint, ea.Connection.LocalEndPoint)) { ea.Connection.Disconnect(); throw new Exception("Access not allowed from this IP."); } base.InvokeOnClientConnected(ea); }
protected internal override void InvokeOnClientDisconnected(SessionEventArgs e) { base.InvokeOnClientDisconnected(e); FtpSession lSession = (FtpSession)e.Session; if (lSession.ActiveConnection != null) { try { lSession.ActiveConnection.Close(); } catch { } lSession.ActiveConnection = null; } if (lSession.PassiveServer != null) { try { lSession.PassiveServer.Close(); } catch { } lSession.PassiveServer = null; } if (lSession.TransferThread != null) { try { lSession.TransferThread.Abort(); } catch { } lSession.TransferThread = null; } }
protected internal virtual void InvokeOnClientDisconnected(SessionEventArgs e) { if (this.OnClientDisconnected != null) this.OnClientDisconnected(this, e); }