Asyncore update
- default to true (original attempt didn't work correctly)
This commit is contained in:
parent
73c41bff9d
commit
02a07e5119
|
@ -858,7 +858,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
objectType, toStreamNumber, encryptedPayload, int(time.time()) + TTL,'')
|
||||
with shared.printLock:
|
||||
print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash)
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((toStreamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -908,7 +908,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL,'')
|
||||
with shared.printLock:
|
||||
print 'broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash)
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((pubkeyStreamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
|
|
@ -90,7 +90,7 @@ def connectToStream(streamNumber):
|
|||
if streamNumber*2+1 not in knownnodes.knownNodes:
|
||||
knownnodes.knownNodes[streamNumber*2+1] = {}
|
||||
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
BMConnectionPool().connectToStream(streamNumber)
|
||||
else:
|
||||
for i in range(state.maximumNumberOfHalfOpenConnections):
|
||||
|
@ -266,7 +266,7 @@ class Main:
|
|||
singleAPIThread.daemon = True # close the main program even if there are threads left
|
||||
singleAPIThread.start()
|
||||
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
asyncoreThread = BMNetworkThread()
|
||||
asyncoreThread.daemon = True
|
||||
asyncoreThread.start()
|
||||
|
@ -282,7 +282,7 @@ class Main:
|
|||
|
||||
connectToStream(1)
|
||||
|
||||
if not BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if not BMConfigParser().get("network", "asyncore"):
|
||||
singleListenerThread = singleListener()
|
||||
singleListenerThread.setup(selfInitiatedConnections)
|
||||
singleListenerThread.daemon = True # close the main program even if there are threads left
|
||||
|
|
|
@ -192,7 +192,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
|
||||
logger.info('broadcasting inv with hash: ' + hexlify(inventoryHash))
|
||||
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -286,7 +286,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
|
||||
logger.info('broadcasting inv with hash: ' + hexlify(inventoryHash))
|
||||
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -380,7 +380,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
|
||||
logger.info('broadcasting inv with hash: ' + hexlify(inventoryHash))
|
||||
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -513,7 +513,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
objectType, streamNumber, payload, embeddedTime, tag)
|
||||
PendingUpload().add(inventoryHash)
|
||||
logger.info('sending inv (within sendBroadcast function) for object: ' + hexlify(inventoryHash))
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -846,7 +846,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
# not sending to a chan or one of my addresses
|
||||
queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr._translate("MainWindow", "Message sent. Waiting for acknowledgement. Sent on %1").arg(l10n.formatTimestamp()))))
|
||||
logger.info('Broadcasting inv for my msg(within sendmsg function):' + hexlify(inventoryHash))
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((toStreamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
@ -952,7 +952,7 @@ class singleWorker(threading.Thread, StoppableThread):
|
|||
objectType, streamNumber, payload, embeddedTime, '')
|
||||
PendingUpload().add(inventoryHash)
|
||||
logger.info('sending inv (for the getpubkey message)')
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
else:
|
||||
protocol.broadcastToSendDataQueues((
|
||||
|
|
|
@ -15,7 +15,7 @@ lastSentBytes = 0
|
|||
currentSentSpeed = 0
|
||||
|
||||
def connectedHostsList():
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
retval = []
|
||||
for i in BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values():
|
||||
if not i.connected:
|
||||
|
@ -29,14 +29,14 @@ def connectedHostsList():
|
|||
return shared.connectedHostsList.items()
|
||||
|
||||
def sentBytes():
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
return asyncore.sentBytes
|
||||
else:
|
||||
return throttle.SendThrottle().total
|
||||
|
||||
def uploadSpeed():
|
||||
global lastSentTimestamp, lastSentBytes, currentSentSpeed
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
currentTimestamp = time.time()
|
||||
if int(lastSentTimestamp) < int(currentTimestamp):
|
||||
currentSentBytes = asyncore.sentBytes
|
||||
|
@ -48,14 +48,14 @@ def uploadSpeed():
|
|||
return throttle.sendThrottle().getSpeed()
|
||||
|
||||
def receivedBytes():
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
return asyncore.receivedBytes
|
||||
else:
|
||||
return throttle.ReceiveThrottle().total
|
||||
|
||||
def downloadSpeed():
|
||||
global lastReceivedTimestamp, lastReceivedBytes, currentReceivedSpeed
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
currentTimestamp = time.time()
|
||||
if int(lastReceivedTimestamp) < int(currentTimestamp):
|
||||
currentReceivedBytes = asyncore.receivedBytes
|
||||
|
@ -67,7 +67,7 @@ def downloadSpeed():
|
|||
return throttle.ReceiveThrottle().getSpeed()
|
||||
|
||||
def pendingDownload():
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
tmp = {}
|
||||
for connection in BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values():
|
||||
for k in connection.objectsNewToMe.keys():
|
||||
|
@ -77,7 +77,7 @@ def pendingDownload():
|
|||
return PendingDownloadQueue.totalSize()
|
||||
|
||||
def pendingUpload():
|
||||
if BMConfigParser().safeGetBoolean("network", "asyncore"):
|
||||
if BMConfigParser().get("network", "asyncore"):
|
||||
return 0
|
||||
tmp = {}
|
||||
for connection in BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values():
|
||||
|
|
Reference in New Issue
Block a user