More cleanups
This commit is contained in:
parent
c1f84c3f29
commit
376c09d189
2 changed files with 9 additions and 8 deletions
|
@ -102,8 +102,7 @@ func (port *EtherTalkPort) HandleRTMP(ctx context.Context, pkt *ddp.ExtPacket) e
|
||||||
}
|
}
|
||||||
|
|
||||||
case rtmp.FunctionLoopProbe:
|
case rtmp.FunctionLoopProbe:
|
||||||
log.Print("RTMP: TODO: handle Loop Probes")
|
return fmt.Errorf("TODO: handle Loop Probes")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ddp.ProtoRTMPResp:
|
case ddp.ProtoRTMPResp:
|
||||||
|
@ -122,7 +121,7 @@ func (port *EtherTalkPort) HandleRTMP(ctx context.Context, pkt *ddp.ExtPacket) e
|
||||||
for _, nt := range dataPkt.NetworkTuples {
|
for _, nt := range dataPkt.NetworkTuples {
|
||||||
route, err := port.Router.RouteTable.UpsertEtherTalkRoute(peer, nt.Extended, nt.RangeStart, nt.RangeEnd, nt.Distance+1)
|
route, err := port.Router.RouteTable.UpsertEtherTalkRoute(peer, nt.Extended, nt.RangeStart, nt.RangeEnd, nt.Distance+1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("RTMP: Couldn't upsert EtherTalk route: %v", err)
|
return fmt.Errorf("upsert EtherTalk route: %v", err)
|
||||||
}
|
}
|
||||||
if len(route.ZoneNames) == 0 {
|
if len(route.ZoneNames) == 0 {
|
||||||
noZones = append(noZones, route.NetStart)
|
noZones = append(noZones, route.NetStart)
|
||||||
|
@ -149,11 +148,13 @@ func (port *EtherTalkPort) HandleRTMP(ctx context.Context, pkt *ddp.ExtPacket) e
|
||||||
},
|
},
|
||||||
Data: qryPkt,
|
Data: qryPkt,
|
||||||
}
|
}
|
||||||
port.Send(ctx, outDDP)
|
if err := port.Send(ctx, outDDP); err != nil {
|
||||||
|
return fmt.Errorf("sending ZIP Query: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log.Printf("RTMP: invalid DDP type %d on socket 1", pkt.Proto)
|
return fmt.Errorf("invalid DDP type %d on socket 1", pkt.Proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (port *EtherTalkPort) handleZIPZIP(ctx context.Context, ddpkt *ddp.ExtPacke
|
||||||
return port.handleZIPQuery(ctx, ddpkt, zipkt)
|
return port.handleZIPQuery(ctx, ddpkt, zipkt)
|
||||||
|
|
||||||
case *zip.ReplyPacket:
|
case *zip.ReplyPacket:
|
||||||
return port.handleZIPReply(ctx, zipkt)
|
return port.handleZIPReply(zipkt)
|
||||||
|
|
||||||
case *zip.GetNetInfoPacket:
|
case *zip.GetNetInfoPacket:
|
||||||
return port.handleZIPGetNetInfo(ctx, ddpkt, zipkt)
|
return port.handleZIPGetNetInfo(ctx, ddpkt, zipkt)
|
||||||
|
@ -158,8 +158,8 @@ func (port *EtherTalkPort) handleZIPQuery(ctx context.Context, ddpkt *ddp.ExtPac
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (port *EtherTalkPort) handleZIPReply(ctx context.Context, zipkt *zip.ReplyPacket) error {
|
func (port *EtherTalkPort) handleZIPReply(zipkt *zip.ReplyPacket) error {
|
||||||
log.Printf("ZIP: Got Reply for networks %v", zipkt.Networks)
|
log.Printf("ZIP: Got Reply containing %v", zipkt.Networks)
|
||||||
|
|
||||||
// Integrate new zone information into route table.
|
// Integrate new zone information into route table.
|
||||||
for n, zs := range zipkt.Networks {
|
for n, zs := range zipkt.Networks {
|
||||||
|
|
Loading…
Reference in a new issue