Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Change init size of buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Mar 1, 2024
1 parent 70f53d6 commit 6503ae9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ func (self *RawNetPort) Pack(b *iovec.IoVec) error {
func (self *RawNetPort) growBuffer() {
l := len(self.buf)
if l == 0 {
l = self.nr * 2
if self.nr == 0 {
l = DEFAULT_BUFFER_SIZE
} else {
l = self.nr * 2
}
} else if l < self.nr/2 {
l = self.nr
}
Expand Down

0 comments on commit 6503ae9

Please sign in to comment.