def _request_helper(rxgobj): # Private helper to get requests. Multiple threads will execute this... thisrequest = rxgobj.get_next_xorrequest() # go until there are no more requests while thisrequest != (): mirrorip = thisrequest[0]['ip'] mirrorport = thisrequest[0]['port'] bitstring = thisrequest[2] try: # request the XOR block... xorblock = uppirlib.retrieve_xorblock_from_mirror( mirrorip, mirrorport, bitstring) except Exception, e: if 'socked' in str(e): rxgobj.notify_failure(thisrequest) sys.stdout.write('F') sys.stdout.flush() else: # otherwise, re-raise... raise else: # we retrieved it successfully... rxgobj.notify_success(thisrequest, xorblock) sys.stdout.write('.') sys.stdout.flush() # regardless of failure or success, get another request... thisrequest = rxgobj.get_next_xorrequest()
def _request_helper(rxgobj): # Private helper to get requests. Multiple threads will execute this... thisrequest = rxgobj.get_next_xorrequest() # go until there are no more requests while thisrequest != (): mirrorip = thisrequest[0]['ip'] mirrorport = thisrequest[0]['port'] bitstring = thisrequest[2] try: # request the XOR block... xorblock = uppirlib.retrieve_xorblock_from_mirror(mirrorip, mirrorport, bitstring) except Exception, e: if 'socked' in str(e): rxgobj.notify_failure(thisrequest) sys.stdout.write('F') sys.stdout.flush() else: # otherwise, re-raise... raise else: # we retrieved it successfully... rxgobj.notify_success(thisrequest, xorblock) sys.stdout.write('.') sys.stdout.flush() # regardless of failure or success, get another request... thisrequest = rxgobj.get_next_xorrequest()
def _request_helper(rxgobj): # Private helper to get requests. Multiple threads will execute this... thisrequest = rxgobj.get_next_xorrequest() # go until there are no more requests while thisrequest != (): mirrorip = thisrequest[0]['ip'] mirrorport = thisrequest[0]['port'] bitstring = thisrequest[2] try: # request the XOR block... xorblock = uppirlib.retrieve_xorblock_from_mirror(mirrorip, mirrorport, bitstring) except Exception, e: if 'socked' in str(e): rxgobj.notify_failure(thisrequest) sys.stdout.write('F') sys.stdout.flush() else: # otherwise, re-raise... raise else: # we retrieved it successfully... rxgobj.notify_success(thisrequest, xorblock) sys.stdout.write('.') sys.stdout.flush() if random.random() >= RANDOM_THRESHOLD: testmirrorinfo = {} testmirrorinfo['ip'] = mirrorip testmirrorinfo['port'] = mirrorport testmirrorinfo['data'] = base64.b64encode(xorblock) testmirrorinfo['chunklist'] = base64.b64encode(bitstring) msg = uppirlib.request_mirror_test(testmirrorinfo, _commandlineoptions.retrievemanifestfrom) print msg # regardless of failure or success, get another request... thisrequest = rxgobj.get_next_xorrequest()