Solved addressGeneratorQueueClass get method issue and added new apiAddressGeneratorReturnQueueQueueClass queue class
This commit is contained in:
parent
4606f55e2f
commit
7609a3ce40
|
@ -38,6 +38,10 @@ class addressGenerator(StoppableThread):
|
||||||
"""A thread for creating addresses"""
|
"""A thread for creating addresses"""
|
||||||
name = "addressGenerator"
|
name = "addressGenerator"
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
StoppableThread.__init__(self)
|
||||||
|
self.lock = threading.Lock()
|
||||||
|
|
||||||
def stopThread(self):
|
def stopThread(self):
|
||||||
try:
|
try:
|
||||||
queues.addressGeneratorQueue.put(("stopThread", "data"))
|
queues.addressGeneratorQueue.put(("stopThread", "data"))
|
||||||
|
@ -56,8 +60,6 @@ class addressGenerator(StoppableThread):
|
||||||
# logger.info('inside the class_addressGenerator\n')
|
# logger.info('inside the class_addressGenerator\n')
|
||||||
# logger.info('current thread -{}'.format(threading.current_thread().name))
|
# logger.info('current thread -{}'.format(threading.current_thread().name))
|
||||||
# logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
# logger.info('&&&&&&&&&&&&&&&&&&&&&&&')
|
||||||
import time
|
|
||||||
time.sleep(1)
|
|
||||||
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
||||||
# logger.info(
|
# logger.info(
|
||||||
# 'queues.addressGeneratorQueue.queue -{}'.format(
|
# 'queues.addressGeneratorQueue.queue -{}'.format(
|
||||||
|
@ -67,14 +69,26 @@ class addressGenerator(StoppableThread):
|
||||||
# logger.info('state.shutdown-{}'.format(state.shutdown))
|
# logger.info('state.shutdown-{}'.format(state.shutdown))
|
||||||
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
# logger.info('MMMMMMMMMMMMMMMMM33333333333333333333333333')
|
||||||
# state.shutdown = 0
|
# state.shutdown = 0
|
||||||
|
logger.error('addressGenerator addressGenerator')
|
||||||
|
logger.error('state.shutdown-{}'.format(state.shutdown))
|
||||||
|
logger.error('--------self----{}'.format(self))
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
queueValue = queues.addressGeneratorQueue.get()
|
logger.error(
|
||||||
|
'qqqqqqqqq1111111111111111111111111111111')
|
||||||
|
with self.lock:
|
||||||
|
queueValue = queues.addressGeneratorQueue.get()
|
||||||
|
logger.error(
|
||||||
|
'qqqqqqqqq2222222222222222222222222222222')
|
||||||
nonceTrialsPerByte = 0
|
nonceTrialsPerByte = 0
|
||||||
logger.info('$$$$$$$$$$$$ queueValue @@@@@@@@@@@-{}'.format(queueValue))
|
# logger.error('$$$$$$$$$$$$ queueValue @@@@@@@@@@@-{}'.format(queueValue))
|
||||||
payloadLengthExtraBytes = 0
|
payloadLengthExtraBytes = 0
|
||||||
live = True
|
live = True
|
||||||
|
logger.error(
|
||||||
|
'qqqqqqqqq3333333333333333333333333333333')
|
||||||
|
logger.error(
|
||||||
|
'qqqqqqqqq33333333333333-{}'.format(queueValue[0] ))
|
||||||
if queueValue[0] == 'createChan':
|
if queueValue[0] == 'createChan':
|
||||||
logger.info(
|
logger.error(
|
||||||
'OOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
|
'OOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
|
||||||
command, addressVersionNumber, streamNumber, label, \
|
command, addressVersionNumber, streamNumber, label, \
|
||||||
deterministicPassphrase, live = queueValue
|
deterministicPassphrase, live = queueValue
|
||||||
|
|
|
@ -45,24 +45,70 @@ class addressGeneratorQueueClass(Queue.Queue):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Queue.Queue.__init__(self)
|
Queue.Queue.__init__(self)
|
||||||
|
|
||||||
|
def put(self, item, block =True, timeout=None):
|
||||||
|
self.debug_file.write('---this put condition--\n')
|
||||||
|
self.debug_file.write('this put condition- ')
|
||||||
|
self.debug_file.write('Current-thread-{} \n'.format(
|
||||||
|
threading.current_thread().name))
|
||||||
|
self.debug_file.write('Traceback-{} \n'.format(
|
||||||
|
str(traceback.print_exc())))
|
||||||
|
self.debug_file.write('Printig the put item-{}'.format(
|
||||||
|
item))
|
||||||
|
Queue.Queue.put(self, item, block, timeout)
|
||||||
|
self.debug_file.write('-------------------\n \n')
|
||||||
|
|
||||||
|
|
||||||
|
def get(self, block =True, timeout=None):
|
||||||
|
self.debug_file.write('---this get condition ---\n')
|
||||||
|
self.debug_file.write('Current-thread-{} \n '.format(
|
||||||
|
threading.current_thread().name))
|
||||||
|
self.debug_file.write('Traceback-{} \n'.format(
|
||||||
|
str(traceback.print_exc())))
|
||||||
|
item = Queue.Queue.get(self, block, timeout)
|
||||||
|
self.debug_file.write('Printig the get item-{}'.format(
|
||||||
|
str(item)))
|
||||||
|
self.debug_file.write('-------------------\n \n')
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
class apiAddressGeneratorReturnQueueQueueClass(Queue.Queue):
|
||||||
|
|
||||||
|
debug_file = open("/tmp/apiAddressGeneratorReturnQueue.log", "a")
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.debug_file.write(
|
||||||
|
'apiAddressGeneratorReturnQueueQueue started.....\n'
|
||||||
|
)
|
||||||
|
Queue.Queue.__init__(self)
|
||||||
|
|
||||||
def put(self, item, block =True, timeout=None):
|
def put(self, item, block =True, timeout=None):
|
||||||
self.debug_file.write('-------------------\n')
|
self.debug_file.write('-------------------\n')
|
||||||
self.debug_file.write('this put condition- ')
|
self.debug_file.write('this put condition- ')
|
||||||
|
self.debug_file.write('@@@@@@ put 51 @@@@@@\n')
|
||||||
self.debug_file.write(threading.current_thread().name)
|
self.debug_file.write(threading.current_thread().name)
|
||||||
self.debug_file.write(traceback.print_exc())
|
self.debug_file.write('@@@@@@ put 53 @@@@@@\n')
|
||||||
|
self.debug_file.write(str(traceback.print_exc()))
|
||||||
|
self.debug_file.write('@@@@@@ put 55 @@@@@@\n')
|
||||||
Queue.Queue.put(self, item, block, timeout)
|
Queue.Queue.put(self, item, block, timeout)
|
||||||
|
self.debug_file.write('@@@@@@ put 57 @@@@@@\n')
|
||||||
self.debug_file.write('-------------------\n')
|
self.debug_file.write('-------------------\n')
|
||||||
|
|
||||||
|
|
||||||
def get(self, item, block =True, timeout=None):
|
def get(self, block =True, timeout=None):
|
||||||
self.debug_file.write('-------------------\n')
|
self.debug_file.write('-------------------\n')
|
||||||
self.debug_file.write('this get condition -')
|
self.debug_file.write('this get condition -')
|
||||||
|
self.debug_file.write('@@@@@@ get 64 @@@@@@')
|
||||||
self.debug_file.write(threading.current_thread().name)
|
self.debug_file.write(threading.current_thread().name)
|
||||||
self.debug_file.write(traceback.print_exc())
|
self.debug_file.write('@@@@@@ get 66 @@@@@@')
|
||||||
|
self.debug_file.write(str(traceback.print_exc()))
|
||||||
|
self.debug_file.write('@@@@@@ get 68 @@@@@@')
|
||||||
item = Queue.Queue.get(self, block, timeout)
|
item = Queue.Queue.get(self, block, timeout)
|
||||||
|
self.debug_file.write('@@@@@@ get 70 @@@@@@')
|
||||||
self.debug_file.write('-------------------\n')
|
self.debug_file.write('-------------------\n')
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
workerQueue = Queue.Queue()
|
workerQueue = Queue.Queue()
|
||||||
UISignalQueue = Queue.Queue()
|
UISignalQueue = Queue.Queue()
|
||||||
addressGeneratorQueue = addressGeneratorQueueClass()
|
addressGeneratorQueue = addressGeneratorQueueClass()
|
||||||
|
@ -75,7 +121,7 @@ portCheckerQueue = Queue.Queue()
|
||||||
receiveDataQueue = Queue.Queue()
|
receiveDataQueue = Queue.Queue()
|
||||||
#: The address generator thread uses this queue to get information back
|
#: The address generator thread uses this queue to get information back
|
||||||
#: to the API thread.
|
#: to the API thread.
|
||||||
apiAddressGeneratorReturnQueue = Queue.Queue()
|
apiAddressGeneratorReturnQueue = apiAddressGeneratorReturnQueueQueueClass()
|
||||||
#: for exceptions
|
#: for exceptions
|
||||||
excQueue = Queue.Queue()
|
excQueue = Queue.Queue()
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user