local seq
This commit is contained in:
parent
21fcf11e5e
commit
f03dea9136
2 changed files with 18 additions and 3 deletions
|
@ -51,6 +51,20 @@ type Transport struct {
|
|||
LocalSeq, RemoteSeq uint16
|
||||
}
|
||||
|
||||
func (tr *Transport) IncLocalSeq() {
|
||||
tr.LocalSeq++
|
||||
if tr.LocalSeq == 0 {
|
||||
tr.LocalSeq = 1
|
||||
}
|
||||
}
|
||||
|
||||
func (tr *Transport) IncRemoteSeq() {
|
||||
tr.RemoteSeq++
|
||||
if tr.RemoteSeq == 0 {
|
||||
tr.RemoteSeq = 1
|
||||
}
|
||||
}
|
||||
|
||||
// domainHeader returns a new domain header suitable for sending a packet.
|
||||
func (tr *Transport) domainHeader(pt PacketType) DomainHeader {
|
||||
return DomainHeader{
|
||||
|
@ -111,10 +125,10 @@ func (tr *Transport) NewOpenRspPacket(envFlags RoutingFlag, rateOrErr int16, opt
|
|||
}
|
||||
}
|
||||
|
||||
func (tr *Transport) NewRIRspPacket(connID, seq uint16, last RoutingFlag, nets NetworkTuples) *RIRspPacket {
|
||||
func (tr *Transport) NewRIRspPacket(last RoutingFlag, nets NetworkTuples) *RIRspPacket {
|
||||
return &RIRspPacket{
|
||||
Header: Header{
|
||||
TrHeader: tr.sequenced(connID, seq),
|
||||
TrHeader: tr.sequenced(tr.RemoteConnID, tr.LocalSeq),
|
||||
CommandCode: CmdCodeRIRsp,
|
||||
Flags: last,
|
||||
},
|
||||
|
|
3
peer.go
3
peer.go
|
@ -233,7 +233,8 @@ func (p *peer) handle(ctx context.Context) error {
|
|||
Distance: 1,
|
||||
},
|
||||
}
|
||||
if _, err := p.send(p.tr.NewRIRspPacket(pkt.ConnectionID, p.tr.LocalSeq, aurp.RoutingFlagLast, nets)); err != nil {
|
||||
p.tr.LocalSeq = 1
|
||||
if _, err := p.send(p.tr.NewRIRspPacket(aurp.RoutingFlagLast, nets)); err != nil {
|
||||
log.Printf("Couldn't send RI-Rsp packet: %v", err)
|
||||
}
|
||||
sstate = ssWaitForRIAck1
|
||||
|
|
Loading…
Reference in a new issue