Skip to content
Permalink
Browse files
Fix: Send multiple pkgs repetitive by tcp (#39)
  • Loading branch information
watermelo committed Jul 18, 2020
1 parent 812064c commit f3a16c17c486056199a16a4b2be5fa931d218aae
Showing 2 changed files with 5 additions and 0 deletions.
@@ -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

0 comments on commit f3a16c1

Please sign in to comment.