Pass config and state to network.start()
This commit is contained in:
parent
54790ac2d9
commit
37344930f6
|
@ -236,17 +236,8 @@ class Main(object):
|
||||||
# start network components if networking is enabled
|
# start network components if networking is enabled
|
||||||
if state.enableNetwork:
|
if state.enableNetwork:
|
||||||
start_proxyconfig()
|
start_proxyconfig()
|
||||||
network.start()
|
network.start(config, state)
|
||||||
|
|
||||||
# Optional components
|
|
||||||
for i in range(config.getint('threads', 'receive')):
|
|
||||||
receiveQueueThread = network.ReceiveQueueThread(i)
|
|
||||||
receiveQueueThread.daemon = True
|
|
||||||
receiveQueueThread.start()
|
|
||||||
if config.safeGetBoolean('bitmessagesettings', 'udp'):
|
|
||||||
state.announceThread = network.AnnounceThread()
|
|
||||||
state.announceThread.daemon = True
|
|
||||||
state.announceThread.start()
|
|
||||||
if config.safeGetBoolean('bitmessagesettings', 'upnp'):
|
if config.safeGetBoolean('bitmessagesettings', 'upnp'):
|
||||||
import upnp
|
import upnp
|
||||||
upnpThread = upnp.uPnPThread()
|
upnpThread = upnp.uPnPThread()
|
||||||
|
|
|
@ -4,19 +4,17 @@ Network subsystem package
|
||||||
|
|
||||||
from announcethread import AnnounceThread
|
from announcethread import AnnounceThread
|
||||||
from connectionpool import BMConnectionPool
|
from connectionpool import BMConnectionPool
|
||||||
from receivequeuethread import ReceiveQueueThread
|
|
||||||
from threads import StoppableThread
|
from threads import StoppableThread
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AnnounceThread", "BMConnectionPool",
|
"AnnounceThread", "BMConnectionPool", "StoppableThread"
|
||||||
"ReceiveQueueThread", "StoppableThread"
|
|
||||||
# "AddrThread", "AnnounceThread", "BMNetworkThread", "Dandelion",
|
# "AddrThread", "AnnounceThread", "BMNetworkThread", "Dandelion",
|
||||||
# "DownloadThread", "InvThread", "UploadThread",
|
# "DownloadThread", "InvThread", "ReceiveQueueThread", "UploadThread",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start(config, state):
|
||||||
"""Start network threads"""
|
"""Start network threads"""
|
||||||
from addrthread import AddrThread
|
from addrthread import AddrThread
|
||||||
from dandelion import Dandelion
|
from dandelion import Dandelion
|
||||||
|
@ -24,6 +22,7 @@ def start():
|
||||||
from invthread import InvThread
|
from invthread import InvThread
|
||||||
from networkthread import BMNetworkThread
|
from networkthread import BMNetworkThread
|
||||||
from knownnodes import readKnownNodes
|
from knownnodes import readKnownNodes
|
||||||
|
from receivequeuethread import ReceiveQueueThread
|
||||||
from uploadthread import UploadThread
|
from uploadthread import UploadThread
|
||||||
|
|
||||||
readKnownNodes()
|
readKnownNodes()
|
||||||
|
@ -45,3 +44,13 @@ def start():
|
||||||
uploadThread = UploadThread()
|
uploadThread = UploadThread()
|
||||||
uploadThread.daemon = True
|
uploadThread.daemon = True
|
||||||
uploadThread.start()
|
uploadThread.start()
|
||||||
|
|
||||||
|
# Optional components
|
||||||
|
for i in range(config.getint('threads', 'receive')):
|
||||||
|
receiveQueueThread = ReceiveQueueThread(i)
|
||||||
|
receiveQueueThread.daemon = True
|
||||||
|
receiveQueueThread.start()
|
||||||
|
if config.safeGetBoolean('bitmessagesettings', 'udp'):
|
||||||
|
state.announceThread = AnnounceThread()
|
||||||
|
state.announceThread.daemon = True
|
||||||
|
state.announceThread.start()
|
||||||
|
|
Reference in New Issue
Block a user