MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / connectToStream

Function connectToStream

src/bitmessagemain.py:71–95  ·  view source on GitHub ↗
(streamNumber)

Source from the content-addressed store, hash-verified

69
70
71def connectToStream(streamNumber):
72 state.streamsInWhichIAmParticipating.append(streamNumber)
73 selfInitiatedConnections[streamNumber] = {}
74
75 if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
76 # Some XP and Vista systems can only have 10 outgoing connections at a time.
77 state.maximumNumberOfHalfOpenConnections = 9
78 else:
79 state.maximumNumberOfHalfOpenConnections = 64
80 try:
81 # don't overload Tor
82 if BMConfigParser().get('bitmessagesettings', 'socksproxytype') != 'none':
83 state.maximumNumberOfHalfOpenConnections = 4
84 except:
85 pass
86
87 with knownnodes.knownNodesLock:
88 if streamNumber not in knownnodes.knownNodes:
89 knownnodes.knownNodes[streamNumber] = {}
90 if streamNumber*2 not in knownnodes.knownNodes:
91 knownnodes.knownNodes[streamNumber*2] = {}
92 if streamNumber*2+1 not in knownnodes.knownNodes:
93 knownnodes.knownNodes[streamNumber*2+1] = {}
94
95 BMConnectionPool().connectToStream(streamNumber)
96
97def _fixSocket():
98 if sys.platform.startswith('linux'):

Callers 1

startMethod · 0.85

Calls 5

BMConfigParserClass · 0.90
BMConnectionPoolClass · 0.90
connectToStreamMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected