mirror of
https://github.com/minio/minio.git
synced 2025-01-12 23:43:22 -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.
|
// Close the connection.
|
||||||
func (c *ConnMux) Close() (err error) {
|
func (c *ConnMux) Close() (err error) {
|
||||||
if err = c.bufrw.Flush(); err != nil {
|
// Make sure that we always close a connection,
|
||||||
return err
|
// even if the bufioWriter flush sends an error.
|
||||||
}
|
defer c.Conn.Close()
|
||||||
return c.Conn.Close()
|
|
||||||
|
// Flush and write to the connection.
|
||||||
|
return c.bufrw.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListenerMux wraps the standard net.Listener to inspect
|
// ListenerMux wraps the standard net.Listener to inspect
|
||||||
|
Loading…
Reference in New Issue
Block a user