mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
fix typos in comments
Co-authored-by: Halimao <1065621723@qq.com>
This commit is contained in:
parent
3dfe877b1d
commit
0a0d38f3ed
4 changed files with 6 additions and 6 deletions
|
|
@ -58,14 +58,14 @@ func newMeteredConn(conn UDPConn) UDPConn {
|
||||||
return &meteredUdpConn{UDPConn: conn}
|
return &meteredUdpConn{UDPConn: conn}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromUDP delegates a network read to the underlying connection, bumping the udp ingress traffic meter along the way.
|
// ReadFromUDPAddrPort delegates a network read to the underlying connection, bumping the udp ingress traffic meter along the way.
|
||||||
func (c *meteredUdpConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
func (c *meteredUdpConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
||||||
n, addr, err = c.UDPConn.ReadFromUDPAddrPort(b)
|
n, addr, err = c.UDPConn.ReadFromUDPAddrPort(b)
|
||||||
ingressTrafficMeter.Mark(int64(n))
|
ingressTrafficMeter.Mark(int64(n))
|
||||||
return n, addr, err
|
return n, addr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write delegates a network write to the underlying connection, bumping the udp egress traffic meter along the way.
|
// WriteToUDP delegates a network write to the underlying connection, bumping the udp egress traffic meter along the way.
|
||||||
func (c *meteredUdpConn) WriteToUDP(b []byte, addr netip.AddrPort) (n int, err error) {
|
func (c *meteredUdpConn) WriteToUDP(b []byte, addr netip.AddrPort) (n int, err error) {
|
||||||
n, err = c.UDPConn.WriteToUDPAddrPort(b, addr)
|
n, err = c.UDPConn.WriteToUDPAddrPort(b, addr)
|
||||||
egressTrafficMeter.Mark(int64(n))
|
egressTrafficMeter.Mark(int64(n))
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,7 @@ func newpipe() *dgramPipe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteToUDP queues a datagram.
|
// WriteToUDPAddrPort queues a datagram.
|
||||||
func (c *dgramPipe) WriteToUDPAddrPort(b []byte, to netip.AddrPort) (n int, err error) {
|
func (c *dgramPipe) WriteToUDPAddrPort(b []byte, to netip.AddrPort) (n int, err error) {
|
||||||
msg := make([]byte, len(b))
|
msg := make([]byte, len(b))
|
||||||
copy(msg, b)
|
copy(msg, b)
|
||||||
|
|
@ -606,7 +606,7 @@ func (c *dgramPipe) WriteToUDPAddrPort(b []byte, to netip.AddrPort) (n int, err
|
||||||
return len(b), nil
|
return len(b), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromUDP just hangs until the pipe is closed.
|
// ReadFromUDPAddrPort just hangs until the pipe is closed.
|
||||||
func (c *dgramPipe) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
func (c *dgramPipe) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error) {
|
||||||
<-c.closing
|
<-c.closing
|
||||||
return 0, netip.AddrPort{}, io.EOF
|
return 0, netip.AddrPort{}, io.EOF
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,7 @@ func (test *udpV5Test) packetIn(packet v5wire.Packet) {
|
||||||
test.packetInFrom(test.remotekey, test.remoteaddr, packet)
|
test.packetInFrom(test.remotekey, test.remoteaddr, packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handles a packet as if it had been sent to the transport by the key/endpoint.
|
// packetInFrom handles a packet as if it had been sent to the transport by the key/endpoint.
|
||||||
func (test *udpV5Test) packetInFrom(key *ecdsa.PrivateKey, addr netip.AddrPort, packet v5wire.Packet) {
|
func (test *udpV5Test) packetInFrom(key *ecdsa.PrivateKey, addr netip.AddrPort, packet v5wire.Packet) {
|
||||||
test.t.Helper()
|
test.t.Helper()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,7 @@ type sharedUDPConn struct {
|
||||||
unhandled chan discover.ReadPacket
|
unhandled chan discover.ReadPacket
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFromUDP implements discover.UDPConn
|
// ReadFromUDPAddrPort implements discover.UDPConn
|
||||||
func (s *sharedUDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, 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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue