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
// ReadFrom reads a packet from the connection,
// copying the payload into p. It returns the number of
// bytes copied into p and the return address that
// was on the packet.
// It returns the number of bytes read (0 <= n <= len(p))
// and any error encountered. Callers should always process
// the n > 0 bytes returned before considering the error err.
// ReadFrom can be made to time out and return an error after a
// fixed time limit; see SetDeadline and SetReadDeadline.
PacketCon.ReadFrom documentation says[1]:
> Callers should always process the n > 0 bytes returned before
> considering the error err.
But we handled err first, and dropped the last read bytes. Fixed by
sending a message if n > 0, and handling the error after the send.
stream.Recv() does is not documented, but the trivial implementation
ensure that we get nil message on any error. Add comment to make it more
clear.
[1] https://pkg.go.dev/net#PacketConnFixeslima-vm#2970
Signed-off-by: Nir Soffer <nirsof@gmail.com>
Based on PacketCon.ReadFrom docs:
https://pkg.go.dev/net#PacketConn
It seems that we need to do:
Originally posted by @tamird in #2969 (comment)
The text was updated successfully, but these errors were encountered: