From f69e2c6d6c32b4289631be509a15fea24080573f Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Tue, 11 Dec 2018 00:24:58 +0400 Subject: [PATCH] p2p: set MConnection#created during init (#2990) Fixes #2715 In crawlPeersRoutine, which is performed when seedMode is run, there is logic that disconnects the peer's state information at 3-hour intervals through the duration value. The duration value is calculated by referring to the created value of MConnection. When MConnection is created for the first time, the created value is not initiated, so it is not disconnected every 3 hours but every time it is disconnected. So, normal nodes are connected to seedNode and disconnected immediately, so address exchange does not work properly. https://github.com/tendermint/tendermint/blob/master/p2p/pex/pex_reactor.go#L629 This point is not work correctly. I think, https://github.com/tendermint/tendermint/blob/master/p2p/conn/connection.go#L148 created variable is missing the current time setting. --- CHANGELOG_PENDING.md | 3 ++- p2p/conn/connection.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 74d81bd5f..a1f5937b1 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -21,4 +21,5 @@ Special thanks to external contributors on this release: ### IMPROVEMENTS: ### BUG FIXES: -- [kv indexer] \#2912 don't ignore key when executing CONTAINS \ No newline at end of file +- [kv indexer] \#2912 don't ignore key when executing CONTAINS +- [p2p] \#2715 fix a bug where seeds don't disconnect from a peer after 3h diff --git a/p2p/conn/connection.go b/p2p/conn/connection.go index c6aad038b..fb20c4775 100644 --- a/p2p/conn/connection.go +++ b/p2p/conn/connection.go @@ -160,6 +160,7 @@ func NewMConnectionWithConfig(conn net.Conn, chDescs []*ChannelDescriptor, onRec onReceive: onReceive, onError: onError, config: config, + created: time.Now(), } // Create channels