updated changes on bitmessagemock

This commit is contained in:
kuldeep.k@cisinlabs.com 2021-12-13 22:18:50 +05:30
parent c5dee5f22e
commit d00f5ee3a8
No known key found for this signature in database
GPG Key ID: AF4FB299BF7C7C2A
2 changed files with 35 additions and 2 deletions

View File

@ -1,3 +1,36 @@
from class_addressGenerator import FakeAddressGenerator
from class_singleWorker import MockSingleWorker
from class_objectProcessor import MockObjectProcessor
from inventory import MockInventory
def main(): def main():
"""Mock main function""" """Mock main function"""
pass def start(self):
"""Start main application"""
# pylint: disable=too-many-statements,too-many-branches,too-many-locals
config = BMConfigParser()
daemon = config.safeGetBoolean('bitmessagesettings', 'daemon')
# Start the address generation thread
addressGeneratorThread = addressGenerator()
# close the main program even if there are threads left
addressGeneratorThread.daemon = True
addressGeneratorThread.start()
# Start the thread that calculates POWs
singleWorkerThread = MockSingleWorker()
# close the main program even if there are threads left
singleWorkerThread.daemon = True
singleWorkerThread.start()
# Start the thread that calculates POWs
objectProcessorThread = MockObjectProcessor()
# DON'T close the main program even the thread remains.
# This thread checks the shutdown variable after processing
# each object.
objectProcessorThread.daemon = False
objectProcessorThread.start()
MockInventory() # init

View File

@ -15,7 +15,7 @@ from network import bmproto
logger = logging.getLogger('default') logger = logging.getLogger('default')
class objectProcessor(threading.Thread): class MockObjectProcessor(threading.Thread):
""" """
The objectProcessor thread, of which there is only one, receives network The objectProcessor thread, of which there is only one, receives network
objects (msg, broadcast, pubkey, getpubkey) from the receiveDataThreads. objects (msg, broadcast, pubkey, getpubkey) from the receiveDataThreads.