aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--p2p/server.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/p2p/server.go b/p2p/server.go
index f61bb897e..b93340150 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -17,6 +17,7 @@ import (
)
const (
+ handshakeTimeout = 5 * time.Second
defaultDialTimeout = 10 * time.Second
refreshPeersInterval = 30 * time.Second
)
@@ -344,7 +345,8 @@ func (srv *Server) findPeers() {
}
func (srv *Server) startPeer(conn net.Conn, dest *discover.Node) {
- // TODO: I/O timeout, handle/store session token
+ // TODO: handle/store session token
+ conn.SetDeadline(time.Now().Add(handshakeTimeout))
remoteID, _, err := srv.handshakeFunc(conn, srv.PrivateKey, dest)
if err != nil {
conn.Close()