Revert "Move a couple of commmon bits of code out to utils.go"

This reverts commit c1856e1ff1.
This commit is contained in:
Bryan Boreham committed 2014-09-09 13:07:55 +01:00
1 parent c1856e1ff1
commit dc927314ba
3 files changed
+22 -23

No files matched your search

+9 -2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"log"
"math/rand"
"net"
"time"
)
@@ -42,7 +43,10 @@ func (cm *ConnectionMaker) InitiateConnection(address string) {
}
func (cm *ConnectionMaker) EnsureConnection(address string) {
address = StripPortFromAddr(address)
// If we've been given a port number, take it off
if addrHost, _, err := net.SplitHostPort(address); err == nil {
address = addrHost
}
cm.queryChan <- &ConnectionMakerInteraction{
Interaction: Interaction{code: CMEnsure},
acceptAnyPeer: false,
@@ -50,7 +54,10 @@ func (cm *ConnectionMaker) EnsureConnection(address string) {
}
func (cm *ConnectionMaker) ConnectionEstablished(address string) {
address = StripPortFromAddr(address)
// If we've been given a port number, take it off
if addrHost, _, err := net.SplitHostPort(address); err == nil {
address = addrHost
}
cm.queryChan <- &ConnectionMakerInteraction{
Interaction: Interaction{code: CMEstablished},
address: address}