Commit f3a16c17 authored by watermelon's avatar watermelon Committed by watermelo

Fix: Send multiple pkgs repetitive by tcp (#39)

parent 812064c9
......@@ -140,6 +140,10 @@ func TestTCPClient(t *testing.T) {
assert.Equal(t, beforeWriteBytes+20, atomic.LoadUint32(&conn.writeBytes))
assert.Nil(t, err)
ss.SetCompressType(CompressSnappy)
err = ss.WriteBytesArray(pkgs...)
assert.Nil(t, err)
assert.Equal(t, beforeWritePkgNum+6, atomic.LoadUint32(&conn.writePkgNum))
assert.Equal(t, beforeWriteBytes+30, atomic.LoadUint32(&conn.writeBytes))
assert.True(t, conn.compress == CompressSnappy)
clt.Close()
......
......@@ -452,6 +452,7 @@ func (s *session) WriteBytesArray(pkgs ...[]byte) error {
if _, err := s.Connection.send(pkgs); err != nil {
return perrors.Wrapf(err, "s.Connection.Write(pkgs num:%d)", len(pkgs))
}
return nil
}
// get len
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment