Rename connClosed -> closed

This commit is contained in:
Davide D'Agostino 2017-05-04 17:46:29 -07:00
parent 7e3820b35d
commit cb362c4101
2 changed files with 6 additions and 5 deletions

View File

@ -81,6 +81,7 @@ func testConn(t *testing.T, disableEPSV bool) {
t.Errorf("'%s'", buf) t.Errorf("'%s'", buf)
} }
r.Close() r.Close()
r.Close() // test we can close two times
} }
// Read with deadline // Read with deadline

6
ftp.go
View File

@ -49,7 +49,7 @@ type Entry struct {
type Response struct { type Response struct {
conn net.Conn conn net.Conn
c *ServerConn c *ServerConn
connClosed bool closed bool
} }
// Connect is an alias to Dial, for backward compatibility // Connect is an alias to Dial, for backward compatibility
@ -538,7 +538,7 @@ func (r *Response) Read(buf []byte) (int, error) {
// Close implements the io.Closer interface on a FTP data connection. // Close implements the io.Closer interface on a FTP data connection.
func (r *Response) Close() error { func (r *Response) Close() error {
if r.connClosed { if r.closed {
return nil return nil
} }
err := r.conn.Close() err := r.conn.Close()
@ -546,7 +546,7 @@ func (r *Response) Close() error {
if err2 != nil { if err2 != nil {
err = err2 err = err2
} }
r.connClosed = true r.closed = true
return err return err
} }