Merge branch 'master' into eliminate_heartbeater

Conflicts:
	router/connection.go
This commit is contained in:
Matthias Radestock committed 2014-12-24 10:48:39 +00:00
commit 108e468ada
2 files changed
+7 -2

No files matched your search

+6 -2
View File
@@ -310,9 +310,8 @@ func (conn *LocalConnection) handshake(acceptNewPeer bool) error {
// ourself. Only when we add this connection to the conn.local
// peer will it be visible from multiple go-routines.
tcpConn := conn.TCPConn
tcpConn.SetKeepAlive(true)
tcpConn.SetLinger(0)
tcpConn.SetNoDelay(true)
conn.extendReadDeadline()
enc := gob.NewEncoder(tcpConn)
@@ -454,6 +453,7 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder, usingPassword bool
var err error
for {
var msg []byte
conn.extendReadDeadline()
if conn.CheckFatal(decoder.Decode(&msg)) != nil {
return
}
@@ -527,6 +527,10 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder, usingPassword bool
}
}
func (conn *LocalConnection) extendReadDeadline() {
conn.TCPConn.SetReadDeadline(time.Now().Add(ReadTimeout))
}
// Heartbeating serves two purposes: a) keeping NAT paths alive, and
// b) updating a remote peer's knowledge of our address, in the event
// it changes (e.g. because NAT paths expired).
+1
View File
@@ -22,6 +22,7 @@ const (
SlowHeartbeat = 10 * time.Second
FetchAllInterval = 30 * time.Second
FragTestInterval = 5 * time.Minute
ReadTimeout = 2 * FetchAllInterval
PMTUVerifyAttempts = 8
PMTUVerifyTimeout = 10 * time.Millisecond // gets doubled with every attempt
MaxDuration = time.Duration(math.MaxInt64)