You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
by golangwink:
The text was updated successfully, but these errors were encountered: