Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions protocol/handshake/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package handshake
import (
"errors"
"fmt"
"sort"
"slices"

"github.com/blinklabs-io/gouroboros/protocol"
)
Expand Down Expand Up @@ -105,9 +105,7 @@ func (s *Server) handleProposeVersions(msg protocol.Message) error {
}

// sort asending - iterating over map is not deterministic
sort.Slice(supportedVersions, func(i, j int) bool {
return supportedVersions[i] < supportedVersions[j]
})
slices.Sort(supportedVersions)

msgRefuse := NewMsgRefuse(
[]any{
Expand Down
10 changes: 3 additions & 7 deletions protocol/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package protocol

import "sort"
import "slices"

// The NtC protocol versions have the 15th bit set in the handshake
const ProtocolVersionNtCOffset = 0x8000
Expand Down Expand Up @@ -322,9 +322,7 @@ func GetProtocolVersionsNtC() []uint16 {
}

// sort asending - iterating over map is not deterministic
sort.Slice(versions, func(i, j int) bool {
return versions[i] < versions[j]
})
slices.Sort(versions)

return versions
}
Expand All @@ -339,9 +337,7 @@ func GetProtocolVersionsNtN() []uint16 {
}

// sort asending - iterating over map is not deterministic
sort.Slice(versions, func(i, j int) bool {
return versions[i] < versions[j]
})
slices.Sort(versions)

return versions
}
Expand Down
Loading