Tweak ZI-Rsp subcode logic
This commit is contained in:
parent
26e9f67dc5
commit
d45678b812
1 changed files with 14 additions and 9 deletions
|
@ -182,15 +182,20 @@ func (tr *Transport) NewRIAckPacket(connID, seq uint16, szi RoutingFlag) *RIAckP
|
||||||
// zone information. It automatically chooses between subcodes 1 or 2 depending
|
// zone information. It automatically chooses between subcodes 1 or 2 depending
|
||||||
// on whether there is one network ID or more than one network ID.
|
// on whether there is one network ID or more than one network ID.
|
||||||
func (tr *Transport) NewZIRspPacket(zones ZoneTuples) *ZIRspPacket {
|
func (tr *Transport) NewZIRspPacket(zones ZoneTuples) *ZIRspPacket {
|
||||||
nns := make(map[uint16]struct{})
|
// Only one zone: use non-extended
|
||||||
for _, z := range zones {
|
subcode := SubcodeZoneInfoNonExt
|
||||||
nns[z.Network] = struct{}{}
|
if len(zones) > 1 {
|
||||||
}
|
// Count distinct networks
|
||||||
// Only one network: use extended
|
nns := make(map[uint16]struct{})
|
||||||
// More than one network: use non-extended
|
for _, z := range zones {
|
||||||
subcode := SubcodeZoneInfoExt
|
nns[z.Network] = struct{}{}
|
||||||
if len(nns) != 1 {
|
}
|
||||||
subcode = SubcodeZoneInfoNonExt
|
|
||||||
|
// Only one network: use extended format
|
||||||
|
// More than one network: use non-extended
|
||||||
|
if len(nns) == 1 {
|
||||||
|
subcode = SubcodeZoneInfoExt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ZIRspPacket{
|
return &ZIRspPacket{
|
||||||
|
|
Loading…
Reference in a new issue