Bitmessage/PyBitmessage

Current PyBitmessage establishes more outbound connections than set by 'maxoutboundconnections'

g1itch opened this issue · 3 comments

Hello!

Lately I constantly see 10 outbound connections on the "Network Status" tab of my PyBitmessage while 'maxoutboundconnections' is set to default 8. I added additional check to TestCore.test_bootstrap() and reproduced the issue in https://travis-ci.org/github/g1itch/PyBitmessage/builds/772095631.

The test is incorrect though.

Well since multiple connections are made in parallel and asynchronously, it could be that some finish connecting after new ones are stopped being made. Should it then drop some later after it happens? And at what stage should it be checked? At fully_established, after receiving addresses, after receiving invs, after pending objects is zero? And which should be dropped? The ones that connected last? Or ones that are slow? Or some other mechanism?

Yea, I see, it opens from 4 to 64 connections at a time and some of them got established when there are already 8 connections. The solution may be to change the range (e.g. using min(state.maximumNumberOfHalfOpenConnections, BMConfigParser().safeGetInt('bitmessagesettings', 'maxoutboundconnections')) - pending). But my problem currently is that I cannot write a proper test.