don't write anything if theres no data

This commit is contained in:
Asim Aslam 2019-12-31 22:58:14 +00:00
parent 45c986c5f1
commit 6358b9277d
1 changed files with 4 additions and 0 deletions

View File

@ -126,6 +126,10 @@ func (c *Codec) Write(m *codec.Message, b interface{}) error {
return err
}
if len(buf) == 0 {
return nil
}
return encode(0, buf, c.Conn)
}