Full Network Tab information API command
This commit is contained in:
parent
8be018e9ac
commit
888a611f61
|
@ -740,8 +740,19 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
return data
|
||||
elif method == 'clientStatus':
|
||||
return '{ "networkConnections" : "%s" }' % str(len(shared.connectedHostsList))
|
||||
elif method == 'fullyConnected':
|
||||
return '"%s"' % shared.definitelyFullyConnected
|
||||
elif method == 'networkTabInfo':
|
||||
data = '{\n \"Total Connections\" : "%s"\n' % str(len(shared.connectedHostsList))
|
||||
data += ' \"P2P Messages Processed\" : "%s"\n' % str(shared.messagesTotals)
|
||||
data += ' \"Broadcast Messages Processed\" : "%s"\n' % str(shared.broadcastTotals)
|
||||
data += ' \"Public Keys Processed\" : "%s"\n' % str(shared.pubkeysTotals)
|
||||
if len(shared.connectedHostsList) == 0:
|
||||
dataColor = 'red'
|
||||
elif len(shared.connectedHostsList) > 0 and not shared.definitelyFullyConnected:
|
||||
dataColor = 'yellow'
|
||||
else:
|
||||
dataColor = 'green'
|
||||
data += ' \"Icon Status\" : "%s"\n}' % dataColor
|
||||
return data
|
||||
else:
|
||||
return 'API Error 0020: Invalid method: %s' % method
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ class receiveDataThread(threading.Thread):
|
|||
self.broadcastinv(self.inventoryHash)
|
||||
shared.UISignalQueue.put((
|
||||
'incrementNumberOfBroadcastsProcessed', 'no data'))
|
||||
|
||||
shared.broadcastTotals = shared.broadcastTotals + 1 # Used specifically for API
|
||||
self.processbroadcast(
|
||||
readPosition, data) # When this function returns, we will have either successfully processed this broadcast because we are interested in it, ignored it because we aren't interested in it, or found problem with the broadcast that warranted ignoring it.
|
||||
|
||||
|
@ -763,7 +763,7 @@ class receiveDataThread(threading.Thread):
|
|||
self.broadcastinv(self.inventoryHash)
|
||||
shared.UISignalQueue.put((
|
||||
'incrementNumberOfMessagesProcessed', 'no data'))
|
||||
|
||||
shared.messagesTotals = shared.messagesTotals + 1 # Used specifically for API
|
||||
self.processmsg(
|
||||
readPosition, data) # When this function returns, we will have either successfully processed the message bound for us, ignored it because it isn't bound for us, or found problem with the message that warranted ignoring it.
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ class receiveDataThread(threading.Thread):
|
|||
self.broadcastinv(inventoryHash)
|
||||
shared.UISignalQueue.put((
|
||||
'incrementNumberOfPubkeysProcessed', 'no data'))
|
||||
|
||||
shared.pubkeysTotals = shared.pubkeysTotals + 1 # Used specifically for API
|
||||
self.processpubkey(data)
|
||||
|
||||
lengthOfTimeWeShouldUseToProcessThisMessage = .2
|
||||
|
|
|
@ -47,7 +47,6 @@ inventory = {} #of objects (like msg payloads and pubkey payloads) Does not incl
|
|||
inventoryLock = threading.Lock() #Guarantees that two receiveDataThreads don't receive and process the same message concurrently (probably sent by a malicious individual)
|
||||
printLock = threading.Lock()
|
||||
appdata = '' #holds the location of the application data storage directory
|
||||
definitelyFullyConnected = False
|
||||
statusIconColor = 'red'
|
||||
connectedHostsList = {} #List of hosts to which we are connected. Used to guarantee that the outgoingSynSender threads won't connect to the same remote node twice.
|
||||
shutdown = 0 #Set to 1 by the doCleanShutdown function. Used to tell the proof of work worker threads to exit.
|
||||
|
@ -66,6 +65,12 @@ apiAddressGeneratorReturnQueue = Queue.Queue(
|
|||
) # The address generator thread uses this queue to get information back to the API thread.
|
||||
ackdataForWhichImWatching = {}
|
||||
|
||||
# Network Tab information
|
||||
messagesTotals = 0
|
||||
broadcastTotals = 0
|
||||
pubkeysTotals = 0
|
||||
definitelyFullyConnected = False
|
||||
|
||||
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
|
||||
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
|
||||
networkDefaultPayloadLengthExtraBytes = 14000 #To make sending short messages a little more difficult, this value is added to the payload length for use in calculating the proof of work target.
|
||||
|
|
Reference in New Issue
Block a user