mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
server/mux: Close the connection even if buffer.Flush() returns error. (#3599)
It is possible that buf.Flush() might return an error, leading to a potential leak in active sockets.
This commit is contained in:
parent
9e1f1b50e0
commit
a17f1e875c
@ -108,10 +108,12 @@ func (c *ConnMux) Read(b []byte) (int, error) {
|
||||
|
||||
// Close the connection.
|
||||
func (c *ConnMux) Close() (err error) {
|
||||
if err = c.bufrw.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
return c.Conn.Close()
|
||||
// Make sure that we always close a connection,
|
||||
// even if the bufioWriter flush sends an error.
|
||||
defer c.Conn.Close()
|
||||
|
||||
// Flush and write to the connection.
|
||||
return c.bufrw.Flush()
|
||||
}
|
||||
|
||||
// ListenerMux wraps the standard net.Listener to inspect
|
||||
|
Loading…
Reference in New Issue
Block a user