Browse Source

Added Logout() method.

Julien Laffaye 12 years ago
parent
commit
91fc6ada34
2 changed files with 11 additions and 0 deletions
  1. 5 0
      client_test.go
  2. 6 0
      ftp.go

+ 5 - 0
client_test.go

@@ -91,6 +91,11 @@ func TestConn(t *testing.T) {
 		t.Error(err)
 		t.Error(err)
 	}
 	}
 
 
+	err = c.Logout()
+	if err != nil {
+		t.Error(err)
+	}
+
 	c.Quit()
 	c.Quit()
 
 
 	err = c.NoOp()
 	err = c.NoOp()

+ 6 - 0
ftp.go

@@ -327,6 +327,12 @@ func (c *ServerConn) NoOp() error {
 	return err
 	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
 // Quit issues a QUIT FTP command to properly close the connection from the
 // remote FTP server.
 // remote FTP server.
 func (c *ServerConn) Quit() error {
 func (c *ServerConn) Quit() error {