mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
p2p: fix sharedUDPConn
This commit is contained in:
parent
e0529692ca
commit
262fe00377
1 changed files with 3 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"net/netip"
|
||||||
"slices"
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -436,10 +437,10 @@ type sharedUDPConn struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromUDP implements discover.UDPConn
|
// ReadFromUDP implements discover.UDPConn
|
||||||
func (s *sharedUDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) {
|
func (s *sharedUDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
||||||
packet, ok := <-s.unhandled
|
packet, ok := <-s.unhandled
|
||||||
if !ok {
|
if !ok {
|
||||||
return 0, nil, errors.New("connection was closed")
|
return 0, netip.AddrPort{}, errors.New("connection was closed")
|
||||||
}
|
}
|
||||||
l := len(packet.Data)
|
l := len(packet.Data)
|
||||||
if l > len(b) {
|
if l > len(b) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue