Move a couple of commmon bits of code out to utils.go
This commit is contained in:
1 parent
527ddfca0d
commit
c1856e1ff1
3 files changed
+23
-22
No files matched your search
+2
-9
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -43,10 +42,7 @@ func (cm *ConnectionMaker) InitiateConnection(address string) {
|
||||
}
|
||||
|
||||
func (cm *ConnectionMaker) EnsureConnection(address string) {
|
||||
// If we've been given a port number, take it off
|
||||
if addrHost, _, err := net.SplitHostPort(address); err == nil {
|
||||
address = addrHost
|
||||
}
|
||||
address = StripPortFromAddr(address)
|
||||
cm.queryChan <- &ConnectionMakerInteraction{
|
||||
Interaction: Interaction{code: CMEnsure},
|
||||
acceptAnyPeer: false,
|
||||
@@ -54,10 +50,7 @@ func (cm *ConnectionMaker) EnsureConnection(address string) {
|
||||
}
|
||||
|
||||
func (cm *ConnectionMaker) ConnectionEstablished(address string) {
|
||||
// If we've been given a port number, take it off
|
||||
if addrHost, _, err := net.SplitHostPort(address); err == nil {
|
||||
address = addrHost
|
||||
}
|
||||
address = StripPortFromAddr(address)
|
||||
cm.queryChan <- &ConnectionMakerInteraction{
|
||||
Interaction: Interaction{code: CMEstablished},
|
||||
address: address}
|
||||
|
||||
Reference in new issue
Block a user