From 91fc6ada341c1efcb15f6a0521a674031a66928f Mon Sep 17 00:00:00 2001 From: Julien Laffaye Date: Sun, 19 May 2013 21:15:23 +0200 Subject: [PATCH] Added Logout() method. --- client_test.go | 5 +++++ ftp.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/client_test.go b/client_test.go index 3abdb84..65bcef6 100644 --- a/client_test.go +++ b/client_test.go @@ -91,6 +91,11 @@ func TestConn(t *testing.T) { t.Error(err) } + err = c.Logout() + if err != nil { + t.Error(err) + } + c.Quit() err = c.NoOp() diff --git a/ftp.go b/ftp.go index 71dae66..ccfa08b 100644 --- a/ftp.go +++ b/ftp.go @@ -327,6 +327,12 @@ func (c *ServerConn) NoOp() error { return err } +// Logout issues a REIN FTP command to logout the current user. +func (c *ServerConn) Logout() error { + _, _, err := c.cmd(StatusLoggedIn, "REIN") + return err +} + // Quit issues a QUIT FTP command to properly close the connection from the // remote FTP server. func (c *ServerConn) Quit() error {