diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-30 00:33:19 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-06-30 00:33:19 +0800 |
commit | 9d8b512b27f691fc1980b850e04eb436a3938626 (patch) | |
tree | 97d199539df243eb406f2427dc2cddaf1ed6b158 /p2p/protocol.go | |
parent | b0a5be4495962c291a25cbea793e43bad0781510 (diff) | |
parent | a7d22658ad81064abad5a12bd38545c98a0c508c (diff) | |
download | dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar.gz dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar.bz2 dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar.lz dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar.xz dexon-9d8b512b27f691fc1980b850e04eb436a3938626.tar.zst dexon-9d8b512b27f691fc1980b850e04eb436a3938626.zip |
Merge pull request #1356 from Gustav-Simonsson/debug_develop
Debug develop
Diffstat (limited to 'p2p/protocol.go')
-rw-r--r-- | p2p/protocol.go | 10 |
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) +} |