conn.Close closes underlying conn

Previously, it merely sent the termination message.
v3-experimental
Jack Christensen 2017-02-13 20:40:04 -06:00
parent f597c16a7b
commit 84802ece05
1 changed files with 5 additions and 0 deletions

View File

@ -425,6 +425,11 @@ func (c *Conn) Close() (err error) {
}
_, err = c.conn.Write([]byte{'X', 0, 0, 0, 4})
if err != nil && c.shouldLog(LogLevelWarn) {
c.log(LogLevelWarn, "Failed to send terminate message", "err", err)
}
err = c.conn.Close()
c.die(errors.New("Closed"))
if c.shouldLog(LogLevelInfo) {