Skip to content

Commit

Permalink
mapResponse: mapResponse.PeersChanged 字段ID升序排列
Browse files Browse the repository at this point in the history
  • Loading branch information
chuanh committed Jun 15, 2023
1 parent 179ba5a commit e0f763a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions controller/protocol_common_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package controller
import (
"encoding/binary"
"encoding/json"
"sort"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -312,6 +313,9 @@ func applyMapResponseDelta(
if err != nil {
return tailcfg.MapResponse{}, err
}
sort.Slice(nodesChanged, func(i, j int) bool {
return nodesChanged[i].ID < nodesChanged[j].ID
})
mapResponse.PeersChanged = nodesChanged

// Update PeersRemoved with any peers which are no longer present
Expand Down

0 comments on commit e0f763a

Please sign in to comment.