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.
This commit is contained in:
Anton Kaliaev 2018-12-11 00:24:58 +04:00 committed by Ethan Buchman
parent d5d0d2bd77
commit f69e2c6d6c
2 changed files with 3 additions and 1 deletions

View File

@ -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
- [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

View File

@ -160,6 +160,7 @@ func NewMConnectionWithConfig(conn net.Conn, chDescs []*ChannelDescriptor, onRec
onReceive: onReceive,
onError: onError,
config: config,
created: time.Now(),
}
// Create channels