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

Commit

Permalink
Change scale factor
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Dec 15, 2023
1 parent 36e7539 commit 986ac8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ func (self *RawNetPort) Unpack(b *iovec.IoVec) error {
if err := self.C.SetReadDeadline(time.Now().Add(self.timeout)); err != nil {
return err
}
const scaleFactor = 2
if self.lastRead < DEFAULT_UDP_BUFFER_SIZE {
self.lastRead = DEFAULT_BUFFER_SIZE
self.lastRead = DEFAULT_BUFFER_SIZE / scaleFactor
}
buf := make([]byte, self.lastRead*6/5)
buf := make([]byte, self.lastRead*scaleFactor)
nr, err := self.C.Read(buf)
if err != nil {
self.lastRead = 0
Expand Down

0 comments on commit 986ac8e

Please sign in to comment.