aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/protocol.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-30 00:33:19 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-30 00:33:19 +0800
commit9d8b512b27f691fc1980b850e04eb436a3938626 (patch)
tree97d199539df243eb406f2427dc2cddaf1ed6b158 /p2p/protocol.go
parentb0a5be4495962c291a25cbea793e43bad0781510 (diff)
parenta7d22658ad81064abad5a12bd38545c98a0c508c (diff)
downloadgo-tangerine-9d8b512b27f691fc1980b850e04eb436a3938626.tar.gz
go-tangerine-9d8b512b27f691fc1980b850e04eb436a3938626.tar.zst
go-tangerine-9d8b512b27f691fc1980b850e04eb436a3938626.zip
Merge pull request #1356 from Gustav-Simonsson/debug_develop
Debug develop
Diffstat (limited to 'p2p/protocol.go')
-rw-r--r--p2p/protocol.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/p2p/protocol.go b/p2p/protocol.go
index 5fa395eda..a229ba911 100644
--- a/p2p/protocol.go
+++ b/p2p/protocol.go
@@ -43,8 +43,10 @@ func (cap Cap) String() string {
return fmt.Sprintf("%s/%d", cap.Name, cap.Version)
}
-type capsByName []Cap
+type capsByNameAndVersion []Cap
-func (cs capsByName) Len() int { return len(cs) }
-func (cs capsByName) Less(i, j int) bool { return cs[i].Name < cs[j].Name }
-func (cs capsByName) Swap(i, j int) { cs[i], cs[j] = cs[j], cs[i] }
+func (cs capsByNameAndVersion) Len() int { return len(cs) }
+func (cs capsByNameAndVersion) Swap(i, j int) { cs[i], cs[j] = cs[j], cs[i] }
+func (cs capsByNameAndVersion) Less(i, j int) bool {
+ return cs[i].Name < cs[j].Name || (cs[i].Name == cs[j].Name && cs[i].Version < cs[j].Version)
+}