Skip to content

Commit

Permalink
Fix: Send multiple pkgs repetitive by tcp (apache#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
watermelo committed Jul 18, 2020
1 parent 812064c commit f3a16c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f3a16c1

Please sign in to comment.