2
0

Remove unnecessary defer

This commit is contained in:
Jack Christensen
2014-04-24 21:26:04 -06:00
parent 97f9fe2209
commit 7ee9b3c7ee
+9 -11
View File
@@ -832,21 +832,19 @@ func (c *Connection) rxMsgHeader() (t byte, bodySize int32, err error) {
return return
} }
func (c *Connection) rxMsgBody(bodySize int32) (buf *bytes.Buffer, err error) { func (c *Connection) rxMsgBody(bodySize int32) (*bytes.Buffer, error) {
if !c.alive { if !c.alive {
err = errors.New("Connection is dead") return nil, errors.New("Connection is dead")
return
} }
defer func() { buf := c.getBuf()
if err != nil { _, err := io.CopyN(buf, c.conn, int64(bodySize))
c.die(err) if err != nil {
} c.die(err)
}() return nil, err
}
buf = c.getBuf() return buf, nil
_, err = io.CopyN(buf, c.conn, int64(bodySize))
return
} }
func (c *Connection) rxAuthenticationX(r *MessageReader) (err error) { func (c *Connection) rxAuthenticationX(r *MessageReader) (err error) {