Retry RI-Req
This commit is contained in:
parent
5a25d6697b
commit
c8d46cef85
1 changed files with 23 additions and 2 deletions
|
@ -167,6 +167,7 @@ func (p *Peer) Handle(ctx context.Context) error {
|
||||||
if sendRetries >= tickleRetryLimit {
|
if sendRetries >= tickleRetryLimit {
|
||||||
log.Printf("AURP Peer: Send retry limit reached while waiting for Tickle-Ack, closing connection")
|
log.Printf("AURP Peer: Send retry limit reached while waiting for Tickle-Ack, closing connection")
|
||||||
rstate = rsUnconnected
|
rstate = rsUnconnected
|
||||||
|
p.RoutingTable.DeletePeer(p)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,12 +177,31 @@ func (p *Peer) Handle(ctx context.Context) error {
|
||||||
log.Printf("AURP Peer: Couldn't send Tickle: %v", err)
|
log.Printf("AURP Peer: Couldn't send Tickle: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// still in Wait For Tickle-Ack
|
||||||
|
|
||||||
case rsWaitForRIRsp:
|
case rsWaitForRIRsp:
|
||||||
// TODO
|
if time.Since(lastSend) <= sendRetryTimer {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if sendRetries >= sendRetryLimit {
|
||||||
|
log.Printf("AURP Peer: Send retry limit reached while waiting for RI-Rsp, closing connection")
|
||||||
|
rstate = rsUnconnected
|
||||||
|
p.RoutingTable.DeletePeer(p)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// RI-Req is stateless, so we don't need to cache the one we
|
||||||
|
// sent earlier just to send it again
|
||||||
|
sendRetries++
|
||||||
|
if _, err := p.Send(p.Transport.NewRIReqPacket()); err != nil {
|
||||||
|
log.Printf("AURP Peer: Couldn't send RI-Req packet: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// still in Wait For RI-Rsp
|
||||||
|
|
||||||
case rsUnconnected:
|
case rsUnconnected:
|
||||||
// TODO
|
// TODO: periodically try to reconnect,
|
||||||
|
// if this peer is in the config file
|
||||||
}
|
}
|
||||||
|
|
||||||
case pkt := <-p.RecieveCh:
|
case pkt := <-p.RecieveCh:
|
||||||
|
@ -245,6 +265,7 @@ func (p *Peer) Handle(ctx context.Context) error {
|
||||||
rstate = rsConnected
|
rstate = rsConnected
|
||||||
|
|
||||||
// Send an RI-Req
|
// Send an RI-Req
|
||||||
|
sendRetries = 0
|
||||||
if _, err := p.Send(p.Transport.NewRIReqPacket()); err != nil {
|
if _, err := p.Send(p.Transport.NewRIReqPacket()); err != nil {
|
||||||
log.Printf("AURP Peer: Couldn't send RI-Req packet: %v", err)
|
log.Printf("AURP Peer: Couldn't send RI-Req packet: %v", err)
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue