Added simple API for boolean of fully connected status (i.e. green light)

This commit is contained in:
Syndicalist 2013-08-02 15:12:42 -04:00
parent db31cb4147
commit 8be018e9ac
3 changed files with 4 additions and 0 deletions

View File

@ -740,6 +740,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'clientStatus': elif method == 'clientStatus':
return '{ "networkConnections" : "%s" }' % str(len(shared.connectedHostsList)) return '{ "networkConnections" : "%s" }' % str(len(shared.connectedHostsList))
elif method == 'fullyConnected':
return '"%s"' % shared.definitelyFullyConnected
else: else:
return 'API Error 0020: Invalid method: %s' % method return 'API Error 0020: Invalid method: %s' % method

View File

@ -256,6 +256,7 @@ class receiveDataThread(threading.Thread):
def connectionFullyEstablished(self): def connectionFullyEstablished(self):
self.connectionIsOrWasFullyEstablished = True self.connectionIsOrWasFullyEstablished = True
if not self.initiatedConnection: if not self.initiatedConnection:
shared.definitelyFullyConnected = True
shared.UISignalQueue.put(('setStatusIcon', 'green')) shared.UISignalQueue.put(('setStatusIcon', 'green'))
self.sock.settimeout( self.sock.settimeout(
600) # We'll send out a pong every 5 minutes to make sure the connection stays alive if there has been no other traffic to send lately. 600) # We'll send out a pong every 5 minutes to make sure the connection stays alive if there has been no other traffic to send lately.

View File

@ -47,6 +47,7 @@ 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) 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() printLock = threading.Lock()
appdata = '' #holds the location of the application data storage directory appdata = '' #holds the location of the application data storage directory
definitelyFullyConnected = False
statusIconColor = 'red' 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. 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. shutdown = 0 #Set to 1 by the doCleanShutdown function. Used to tell the proof of work worker threads to exit.