#NEWLINE# def send( self , load , tries = 3 , timeout = 60 ) : #NEWLINE# #INDENT# '\n        Send a message load and wait for a relative reply\n        One shot wonder\n        ' #NEWLINE# self . __prep_stack ( ) #NEWLINE# tried = 1 #NEWLINE# start = time . time ( ) #NEWLINE# track = nacling . uuid ( 18 ) #NEWLINE# src = ( None , self . stack . local . name , track ) #NEWLINE# self . route = { #NEWLINE# #INDENT# 'src' : src , #NEWLINE# 'dst' : self . dst , #NEWLINE# #UNINDENT# } #NEWLINE# msg = { #NEWLINE# #INDENT# 'route' : self . route , #NEWLINE# 'load' : load , #NEWLINE# #UNINDENT# } #NEWLINE# self . stack . transmit ( msg , self . stack . nameRemotes [ self . ryn ] . uid ) #NEWLINE# while ( track not in jobber_rxMsgs ) : #NEWLINE# #INDENT# self . stack . serviceAll ( ) #NEWLINE# while self . stack . rxMsgs : #NEWLINE# #INDENT# ( msg , sender ) = self . stack . rxMsgs . popleft ( ) #NEWLINE# jobber_rxMsgs [ msg [ 'route' ] [ 'dst' ] [ 2 ] ] = msg #NEWLINE# continue #NEWLINE# #UNINDENT# if ( track in jobber_rxMsgs ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( ( time . time ( ) - start ) > timeout ) : #NEWLINE# #INDENT# if ( load >= tries ) : #NEWLINE# #INDENT# raise ValueError ( "Message send timed out after '{0} * {1}' secs. route = {2} track = {3} load={4}" . format ( tries , timeout , self . route , track , load ) ) #NEWLINE# #UNINDENT# self . stack . transmit ( msg , self . stack . nameRemotes [ 'manor' ] . uid ) #NEWLINE# tried += 1 #NEWLINE# #UNINDENT# time . sleep ( 0.01 ) #NEWLINE# #UNINDENT# return jobber_rxMsgs . pop ( track ) . get ( 'return' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } )