-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
by golangwink:
for {
var e error
frag, e = b.ReadSlice(delim)
if e == nil { // got final fragment
break
}
if e != ErrBufferFull { // unexpected error
err = e
break
}
// Make a copy of the buffer.
buf := make([]byte, len(frag))
copy(buf, frag)
full = append(full, buf) // if full is too big?
}
The bufio.ReadBytes don't have a limit to append, it isn't a problem when use if for
files, but when you use bufio.ReadBytes for net socket, the client may never give you
the correct delimiter.
Then the memory of server will use up by even if only a connection.
thank you for your attention!Reactions are currently unavailable