Skip to content

Commit

Permalink
WIP cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matzf committed Jul 3, 2024
1 parent 86de517 commit 9472354
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pkg/snet/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func (c *scionConnReader) read(b []byte) (int, *UDPAddr, error) {
Bytes: Bytes(c.buffer),
}
var lastHop net.UDPAddr
err := c.readPacketUDP(&pkt, &lastHop)
if err != nil {
if err := c.readPacketUDP(&pkt, &lastHop); err != nil {
return 0, nil, err
}

Expand Down Expand Up @@ -117,12 +116,11 @@ func (c *scionConnReader) read(b []byte) (int, *UDPAddr, error) {
return n, remote, nil
}

// readPacketUDP repeatedly reads a packet until a UDP datagram is found.
// readPacketUDP repeatedly reads a packet until a UDP datagram is found or an error occurs.
// If an SCMP Handler is configured, it will be called on SCMP messages.
func (c *scionConnReader) readPacketUDP(pkt *Packet, lastHop *net.UDPAddr) error {
for {
err := c.conn.ReadFrom(pkt, lastHop)
if err != nil {
if err := c.conn.ReadFrom(pkt, lastHop); err != nil {
return err
}

Expand All @@ -133,11 +131,9 @@ func (c *scionConnReader) readPacketUDP(pkt *Packet, lastHop *net.UDPAddr) error
if c.scmpHandler == nil {
continue
}
err := c.scmpHandler.Handle(pkt)
if err != nil {
if err := c.scmpHandler.Handle(pkt); err != nil {
return err
}
continue
default:
continue
}
Expand Down
1 change: 1 addition & 0 deletions scion-pki/certs/renew.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ func (r *renewer) requestRemote(
Topology: r.Daemon,
SCMPHandler: snet.DefaultSCMPHandler{
RevocationHandler: daemon.RevHandler{Connector: r.Daemon},
Log: log.FromCtx(ctx).Debug,
},
}

Expand Down

0 comments on commit 9472354

Please sign in to comment.