x/net: ReadBatch fails if conn passed to ipv4.New{Packet}Conn is not a net.{TCP/UDP}Conn #42444
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When passing a wrapped connection to
ipv4.NewPacketConn()
, calls toReadBatch()
will fail with aninvalid connection
error:This is unexpected, as
NewPacketConn
accepts anet.PacketConn
, and does not require anet.UDPConn
.Analogously for
NewConn
with anet.TCPConn
.The problem here is that the constructor calls
socket.NewConn
, which does a type assertion: https://github.com/golang/net/blob/ff519b6c91021e6316e1df005bc19f266994ddda/internal/socket/rawconn.go#L21-L41, which will fail if theUPDConn
is wrapped.What did you expect to see?
I expected
ReadBatch
to work.What did you see instead?
See above.
The text was updated successfully, but these errors were encountered: