aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/peer.go b/peer.go
index ffba695ca..691a2f575 100644
--- a/peer.go
+++ b/peer.go
@@ -4,15 +4,16 @@ import (
"bytes"
"container/list"
"fmt"
- "github.com/ethereum/eth-go/ethchain"
- "github.com/ethereum/eth-go/ethlog"
- "github.com/ethereum/eth-go/ethutil"
- "github.com/ethereum/eth-go/ethwire"
"net"
"strconv"
"strings"
"sync/atomic"
"time"
+
+ "github.com/ethereum/eth-go/ethchain"
+ "github.com/ethereum/eth-go/ethlog"
+ "github.com/ethereum/eth-go/ethutil"
+ "github.com/ethereum/eth-go/ethwire"
)
var peerlogger = ethlog.NewLogger("PEER")
@@ -197,10 +198,12 @@ func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer {
}
func (self *Peer) Connect(addr string) (conn net.Conn, err error) {
- for attempts := 0; attempts < 5; attempts++ {
+ const maxTries = 3
+ for attempts := 0; attempts < maxTries; attempts++ {
conn, err = net.DialTimeout("tcp", addr, 10*time.Second)
if err != nil {
- peerlogger.Debugf("Peer connection failed. Retrying (%d/5)\n", attempts+1)
+ //peerlogger.Debugf("Peer connection failed. Retrying (%d/%d) (%s)\n", attempts+1, maxTries, addr)
+ time.Sleep(time.Duration(attempts*20) * time.Second)
continue
}