def get_latencies(): """ <Purpose> Retrieves latency information (for all nodes) from a single node in NODEIPLIST. <Arguments> None. <Exceptions> Exception if the socket is closed either locally or remotely. ValueError if the string received from node is corrupted. TypeError if the type of 'data' used in string received from node isn't allowed. <Side Effects> None. <Returns> Dictionary of node latency information. """ sampleip = NODEIPLIST[0] try: sock = repyportability.openconn(sampleip, CBFUNC_CONTEXT['geniport']) latency_dict = serialize_deserializedata(recv_all(sock)) except Exception, e: raise
message_received = "" while True: try: message_received = sockobj.recv(1024) except Exception, err: # If there is any exception, we return because # we did not receive the proper message. sockobj.close() return if message_received: break # Open a connection to the server to send the message. server_sockobj = repyportability.openconn(server_address, server_port) # If we fail to send the message, then we just close # the connection and return. try: server_sockobj.send(message_received) except: server_sockobj.close() sockobj.close() return # We will now receive the response from the server # and forward them back to the client. while True: try: