refactor: relocate an optimisation -> reduce duplication
This commit is contained in:
1 parent
5473995305
commit
f58e3bf2a9
2 files changed
+7
-13
No files matched your search
@@ -45,6 +45,9 @@ func (peer *LocalPeer) ConnectionTo(name PeerName) (Connection, bool) {
|
||||
}
|
||||
|
||||
func (peer *LocalPeer) ConnectionsTo(names []PeerName) []Connection {
|
||||
if len(names) == 0 {
|
||||
return nil
|
||||
}
|
||||
conns := make([]Connection, 0, len(names))
|
||||
peer.RLock()
|
||||
defer peer.RUnlock()
|
||||
|
||||
Reference in new issue
Block a user