def _sendNextInterest(self, name): interest = Interest(name) uri = name.toUri() interest.setInterestLifetimeMilliseconds(4000) interest.setMustBeFresh(True) if uri not in self.outstanding: self.outstanding[uri] = 1 self.face.expressInterest(interest, self._onData, self._onTimeout) print "Sent Interest for %s" % uri
async def sync_update(self, branch: str, timestamp: int): commit = "" data = Data() def update_db(): nonlocal commit # Fix the database if timestamp <= self.branches[branch].timestamp: return self.update_branch(branch, timestamp, commit, data.wireEncode().toBytes()) if branch in self.branches: # Update existing branch branch_info = self.branches[branch] if branch_info.timestamp < timestamp: interest = Interest(Name(self.repo_prefix).append("refs").append(branch).appendTimestamp(timestamp)) print("ON SYNC UPDATE", interest.name.toUri()) data = await fetch_data_packet(self.face, interest) if isinstance(data, Data): commit = data.content.toBytes().decode("utf-8") else: print("error: Couldn't fetch refs") return fetcher = self.fetch(commit) await asyncio.wait_for(fetcher.wait_until_finish(), None) update_db() print("Update branch", branch, timestamp) else: # Fetch new branch interest = Interest(Name(self.repo_prefix).append("branch-info").append(branch)) print("ON NEW BRANCH", interest.name.toUri()) data = await fetch_data_packet(self.face, interest) if isinstance(data, Data): branchinfo = pickle.loads(data.content.toBytes()) else: print("error: Couldn't fetch branch-info") return self.branches[branch] = branchinfo await self.sync_update(branch, timestamp)
def test_interest_timestamp(self): interestName = Name('/ndn/ucla/edu/something') certName = self.keyChain.getPib().getIdentity( self.identityName).getKey( self.keyName).getDefaultCertificate().getName() face = Face("localhost") face.setCommandSigningInfo(self.keyChain, certName) oldInterest = Interest(interestName) face.makeCommandInterest(oldInterest) time.sleep(0.1) # make sure timestamps are different newInterest = Interest(interestName) face.makeCommandInterest(newInterest) vr = doVerify(self.policyManager, newInterest) self.assertFalse( vr.hasFurtherSteps, "ConfigPolicyManager returned ValidationRequest but certificate is known" ) self.assertEqual(vr.failureCount, 0, "Verification of valid interest failed") self.assertEqual( vr.successCount, 1, "Verification success called {} times instead of 1".format( vr.successCount)) vr = doVerify(self.policyManager, oldInterest) self.assertFalse( vr.hasFurtherSteps, "ConfigPolicyManager returned ValidationRequest but certificate is known" ) self.assertEqual(vr.successCount, 0, "Verification of stale interest succeeded") self.assertEqual( vr.failureCount, 1, "Failure callback called {} times instead of 1".format( vr.failureCount))
def main(): face = Face() keychain = KeyChain() face.setCommandSigningInfo(keychain, keychain.getDefaultCertificateName()) running = True # The following line doesn't work sometimes # interest = Interest("/icear-server/calc") interest = Interest(Name("/icear-server/calc")) param_msg = SegmentParameterMessage() param_msg.segment_parameter.name.component.append( bytes("example-data", "utf-8")) param_msg.segment_parameter.start_frame = 2 param_msg.segment_parameter.end_frame = 3 op = param_msg.segment_parameter.operations.components.add() op.model = bytes("deeplab", "utf-8") op.flags = 0 op = param_msg.segment_parameter.operations.components.add() op.model = bytes("la_muse", "utf-8") op.flags = 0 interest.name.append(ProtobufTlv.encode(param_msg)) interest.mustBeFresh = True interest.interestLifetimeMilliseconds = 4000.0 interest.setCanBePrefix(True) def on_data(_, data): # type: (Interest, Data) -> None nonlocal running print(data.name.toUri()) print(data.content.toBytes()) running = False def on_timeout(_): nonlocal running print("Timeout") running = False def on_nack(_, nack): # type: (Interest, NetworkNack) -> None nonlocal running print("NACK") print(nack.getReason()) running = False face.expressInterest(interest, on_data, on_timeout, on_nack) while running: face.processEvents() time.sleep(0.01) face.shutdown()
def onData(self, interest, data): self._keyChain.verifyData(data, self.onVerified, self.onVerifyFailed) dataName = data.getName() dataQueue = None if __debug__: print("Got data: " + dataName.toUri() + "; " + data.getContent().toRawStr()) for i in range(0, len(dataName)): if dataName.get(i).toEscapedString() == AGGREGATION_COMPONENT: dataType = dataName.get(i - 1).toEscapedString() aggregationType = dataName.get(i + 1).toEscapedString() startTime = int(dataName.get(i + 2).toEscapedString()) endTime = int(dataName.get(i + 3).toEscapedString()) childName = dataName.get(i - 3).toEscapedString() dataAndAggregationType = dataType + aggregationType dataDictKey = self.getDataDictKey(startTime, endTime, childName) dataQueue = self._dataQueue[dataAndAggregationType] dataQueue._dataDict[dataDictKey] = data break # TODO: check what if interval/starttime is misconfigured if dataQueue: self.calculateAggregation(dataType, aggregationType, dataQueue._childrenList, startTime, endTime - startTime, dataQueue._publishingPrefix) # Always ask for the next piece of data when we receive this one; assumes interval does not change; this also assumes there are no more components after endTime #newInterestName = dataName.getPrefix(i + 2).append(str(endTime)).append(str(endTime + (endTime - startTime))) # We don't expect aggregated data name to be continuous within our given time window, so we ask with exclusion instead newInterestName = dataName.getPrefix(i + 2) newInterest = Interest(interest) newInterest.setName(newInterestName) newInterest.setChildSelector(0) exclude = Exclude() exclude.appendAny() exclude.appendComponent(dataName.get(i + 2)) newInterest.setExclude(exclude) self._face.expressInterest(newInterest, self.onData, self.onTimeout) if __debug__: print(" issue interest: " + interest.getName().toUri()) return
async def insert_segmented_file(self): event_loop = asyncio.get_event_loop() face_task = event_loop.create_task(self.face_loop()) parameter = RepoCommandParameterMessage() for compo in self.name_at_repo: parameter.repo_command_parameter.name.component.append( compo.getValue().toBytes()) parameter.repo_command_parameter.start_block_id = 0 parameter.repo_command_parameter.end_block_id = self.n_packets - 1 param_blob = ProtobufTlv.encode(parameter) # Prepare cmd interest name = Name(self.repo_name).append('insert').append( Name.Component(param_blob)) interest = Interest(name) self.face.makeCommandInterest(interest) logging.info('Send insert command interest') ret = await fetch_data_packet(self.face, interest) if not isinstance(ret, Data): logging.warning('Insert failed') return response = RepoCommandResponseMessage() try: ProtobufTlv.decode(response, ret.content) except RuntimeError as exc: logging.warning('Response decoding failed', exc) process_id = response.repo_command_response.process_id status_code = response.repo_command_response.status_code logging.info('Insertion process {} accepted: status code {}'.format( process_id, status_code)) # Use insert check command to probe if insert process is completed checker = CommandChecker(self.face, self.keychain) while True: response = await checker.check_insert(self.repo_name, process_id) if response is None or response.repo_command_response.status_code == 300: await asyncio.sleep(1) elif response.repo_command_response.status_code == 200: logging.info( 'Insert process {} status: {}, insert_num: {}'.format( process_id, response.repo_command_response.status_code, response.repo_command_response.insert_num)) break else: # Shouldn't get here assert (False) self.running = False await face_task
def pingFace(srcFace, dstPrefix, iterNumber): print("Will ping from", srcFace, dstPrefix, "iterNumber:", iterNumber) face = valid_faces[srcFace] name = Name(dstPrefix) #name.append("ping") name.append(Name(srcFace)) name.appendSequenceNumber(iterNumber) #print("name:", name) interest = Interest(name) face.expressInterest(interest, onData, onTimeout, onNack) face.processEvents()
def connection_test(self): interest = Interest("/localhost/nfd/faces/events") interest.mustBeFresh = True interest.canBePrefix = True interest.interestLifetimeMilliseconds = 1000 try: def empty(*_args, **_kwargs): pass self.face.expressInterest(interest, empty, empty, empty) return True except (ConnectionRefusedError, BrokenPipeError, OSError): return False
def _sendNextInterest(self, name): interest = Interest(name) uri = name.toUri() interest.setApplicationParameters(self.prefixesToSend) interest.setInterestLifetimeMilliseconds(4000) interest.setMustBeFresh(True) if uri not in self.outstanding: self.outstanding[uri] = 1 self.face.expressInterest(interest, self._onData, self._onTimeout) print "Sent Chat Prefixes to host " + str(self.host)
def sendRandomCommand(self): try: chosenCommand = random.choice(self._ledCommands) interest = Interest(Name(chosenCommand)) self.log.debug('Sending command {}'.format(chosenCommand)) # uncomment the following line to sign interests (slower than unsigned) #self.face.makeCommandInterest(interest) self.face.expressInterest(interest, self.onCommandAck, self.onCommandTimeout) except IndexError: pass finally: self.loop.call_later(1, self.sendRandomCommand)
async def fetch_object(face: Face, prefix: Name, semaphore: asyncio.Semaphore) -> Optional[bytes]: async def retry_or_fail() -> Optional[Data]: nonlocal interest result = None # retry for up to FETCHER_MAX_ATTEMPT_NUMBER times for _ in range(FETCHER_MAX_ATTEMPT_NUMBER): # express interest async with semaphore: response = await fetch_data_packet(face, interest) if isinstance(response, Data): # if succeeded, jump out result = response break else: # if failed, wait for next time await asyncio.sleep(FETCHER_RETRY_INTERVAL / 1000.0) return result data = bytes("", "utf-8") final_id = FETCHER_FINAL_BLOCK_ID cur_id = 0 while cur_id <= final_id: if cur_id == 0: interest = Interest(Name(prefix)) else: interest = Interest(Name(prefix).appendSegment(cur_id)) data_packet = await retry_or_fail() if data_packet is None: return None data += data_packet.content.toBytes() final_id_component = data_packet.metaInfo.getFinalBlockId() if final_id_component.isSegment(): final_id = final_id_component.toSegment() else: break cur_id += 1 return data
def main(): interest = Interest() interest.wireDecode(TlvInterest) dump("Interest:") dumpInterest(interest) encoding = interest.wireEncode() dump("") dump("Re-encoded interest", encoding.toHex()) reDecodedInterest = Interest() reDecodedInterest.wireDecode(encoding) dump("Re-decoded Interest:") dumpInterest(reDecodedInterest) freshInterest = Interest(Name("/ndn/abc")) freshInterest.setMustBeFresh(False) dump(freshInterest.toUri()) freshInterest.setMinSuffixComponents(4) freshInterest.setMaxSuffixComponents(6) freshInterest.getKeyLocator().setType(KeyLocatorType.KEY_LOCATOR_DIGEST) freshInterest.getKeyLocator().setKeyData( bytearray([ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F ])) freshInterest.getExclude().appendComponent(Name("abc")[0]).appendAny() freshInterest.setInterestLifetimeMilliseconds(30000) freshInterest.setChildSelector(1) freshInterest.setMustBeFresh(True) freshInterest.setScope(2) reDecodedFreshInterest = Interest() reDecodedFreshInterest.wireDecode(freshInterest.wireEncode()) dump("") dump("Re-decoded fresh Interest:") dumpInterest(reDecodedFreshInterest)
def sendCommand(self, commandInterest, arguments, responseHandle): def onData(interest, data): # TODO: verify data responseHandle(commandInterest, Response(data)) def onTimeout(interest): responseHandle(commandInterest, NdnCtrl.Timeout) interest = Interest(commandInterest) if arguments: interest.setParameters(json.dumps(arguments)) interest.appendParametersDigestToName() # TODO: sign interest self.face_.expressInterest(interest, onData, onTimeout)
def initiateContentStoreInsertion(self, repoCommandPrefix, data): fetchName = data.getName() parameter = repo_command_parameter_pb2.RepoCommandParameterMessage() # Add the Name. for i in range(fetchName.size()): parameter.repo_command_parameter.name.component.append( fetchName[i].getValue().toBytes()) # Create the command interest. interest = Interest(Name(repoCommandPrefix).append("insert") .append(Name.Component(ProtobufTlv.encode(parameter)))) self.face.makeCommandInterest(interest) self.face.expressInterest(interest, self.onRepoData, self.onRepoTimeout)
def sendProbeInterest(self): probeInterest = Interest( Name(self.caPrefix).append("CA").append("_PROBE")) probeInterest.setMustBeFresh(True) probeInterest.setCanBePrefix(False) probeInterest.setApplicationParameters( json.dumps({"email": "*****@*****.**"}, indent=4)) probeInterest.appendParametersDigestToName() print("Expressing interest: {}".format(probeInterest.getName())) self.face.expressInterest(probeInterest, self.onProbeData, self.onTimeout)
def createLightingCommand(self, color): interestName = Name(self.lightPrefix).append('setRGB') print "interest prefix", self.lightPrefix, type(self.lightPrefix) commandParams = LightCommandMessage() messageColor = commandParams.command.pattern.colors.add() messageColor.r = color[0] messageColor.g = color[1] messageColor.b = color[2] commandName = interestName.append(ProtobufTlv.encode(commandParams)) interest = Interest(commandName) return interest
def _sendNextInterest(self, name): # Create an Interest using the specificed run&clip number with the frame-annotation namespace and record it in our outstanding Interest. # Then, send the Interest out our Face. interest = Interest(name) uri_i = name.toUri() interest.setInterestLifetimeMilliseconds(4000) interest.setMustBeFresh(True) if uri_i not in self.outstanding: self.outstanding[uri_i] = 1 self.face.expressInterest(interest, self._onData, self._onTimeout) print("Sent Interest for %s" % uri_i)
async def face_event(self): last_seq = -1 retry_time = 3000 retry_count_limit = 60000 // retry_time retry_count = 0 while self.running and self.face: name = Name("/localhost/nfd/faces/events") face_interest = Interest() if last_seq >= 0: name.appendSequenceNumber(last_seq + 1) face_interest.canBePrefix = False else: face_interest.mustBeFresh = True face_interest.canBePrefix = True logging.info("Face event notification stream %s", name.toUri()) face_interest.name = name # face_interest.interestLifetimeMilliseconds = 60000 face_interest.interestLifetimeMilliseconds = retry_time ret = await fetch_data_packet(self.face, face_interest) timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") if isinstance(ret, Data): retry_count = 0 last_seq = ret.name[-1].toSequenceNumber() face_event = FaceEventNotificationMessage() try: ProtobufTlv.decode(face_event, ret.content) dic = self.face_event_to_dict(face_event.face_event_notification) dic['seq'] = str(last_seq) dic['time'] = timestamp self.emit('face event', dic) self.event_list.append(dic) except RuntimeError as exc: logging.fatal('Decode failed %s', exc) last_seq = -1 elif ret is None: if retry_count >= retry_count_limit: logging.info("No response: face event") last_seq = -1 retry_count = 0 else: retry_count += 1 else: logging.info("NFD is not running: start reconnection") self.start_reconnection() return await asyncio.sleep(0.1)
def stopRepoWatch(face, repoCommandPrefix, watchPrefix, onRepoWatchStopped, onFailed): """ Send a command interest for the repo to stop watching the given watchPrefix. Since this calls expressInterest, your application must call face.processEvents. :param Face face: The Face used to call makeCommandInterest and expressInterest. :param Name repoCommandPrefix: The repo command prefix. :param Name watchPrefix: The prefix that the repo will stop watching. :param onRepoWatchStopped: When the stop watch command successfully returns, this calls onRepoWatchStopped(). :type onRepoWatchStopped: function object :param onFailed: If the command fails for any reason, this prints an error and calls onFailed(). :type onFailed: function object """ # repo_command_parameter_pb2 was produced by protoc. parameter = repo_command_parameter_pb2.RepoCommandParameterMessage() for i in range(watchPrefix.size()): parameter.repo_command_parameter.name.component.append( watchPrefix[i].getValue().toBytes()) # Create the command interest. interest = Interest( Name(repoCommandPrefix).append("watch").append("stop").append( Name.Component(ProtobufTlv.encode(parameter)))) face.makeCommandInterest(interest) # Send the command interest and get the response or timeout. def onData(interest, data): # repo_command_response_pb2 was produced by protoc. response = repo_command_response_pb2.RepoCommandResponseMessage() try: ProtobufTlv.decode(response, data.content) except: dump("Cannot decode the repo command response") onFailed() if response.repo_command_response.status_code == 101: onRepoWatchStopped() else: dump("Got repo command error code", response.repo_command_response.status_code) onFailed() def onTimeout(interest): dump("Stop repo watch command timeout") onFailed() face.expressInterest(interest, onData, onTimeout)
def test_find_by_interest(self): self.anchorContainer.insert("group1", self.certificatePath1, 400.0) interest = Interest(self.identity1.getName()) self.assertTrue(self.anchorContainer.find(interest) != None) interest1 = Interest(self.identity1.getName().getPrefix(-1)) self.assertTrue(self.anchorContainer.find(interest1) != None) interest2 = Interest(Name(self.identity1.getName()).appendVersion(1)) self.assertTrue(self.anchorContainer.find(interest2) == None) certificate3 = self.fixture.addCertificate( self.identity1.getDefaultKey(), "3") certificate4 = self.fixture.addCertificate( self.identity1.getDefaultKey(), "4") certificate5 = self.fixture.addCertificate( self.identity1.getDefaultKey(), "5") certificate3Copy = CertificateV2(certificate3) self.anchorContainer.insert("group2", certificate3Copy) self.anchorContainer.insert("group3", certificate4) self.anchorContainer.insert("group4", certificate5) interest3 = Interest(certificate3.getKeyName()) foundCertificate = self.anchorContainer.find(interest3) self.assertTrue(foundCertificate != None) self.assertTrue(interest3.getName().isPrefixOf( foundCertificate.getName())) self.assertTrue(certificate3.getName().equals( foundCertificate.getName())) interest3.getExclude().appendComponent(certificate3.getName().get( CertificateV2.ISSUER_ID_OFFSET)) foundCertificate = self.anchorContainer.find(interest3) self.assertTrue(foundCertificate != None) self.assertTrue(interest3.getName().isPrefixOf( foundCertificate.getName())) self.assertTrue( not foundCertificate.getName().equals(certificate3.getName()))
def requestInsert(face, repoCommandPrefix, fetchName, onInsertStarted, onFailed): # Construct a RepoCommandParameterMessage using the structure in # repo_command_parameter_pb2 which was produced by protoc. parameter = repo_command_parameter_pb2.RepoCommandParameterMessage() # Add the Name. msgName = parameter.Name() # 1. pattern name msgName.Clear() msgName.component.append(PATTERN_NAME[0].getValue().toBytes()) parameter.repo_command_parameter.name.component.append( ProtobufTlv.encode(msgName).toBytes()) # 2. fetch prefix msgName.Clear() for compo in fetchName: msgName.component.append(compo.getValue().toBytes()) parameter.repo_command_parameter.name.component.append( ProtobufTlv.encode(msgName).toBytes()) # Create the command interest. interest = Interest( Name(repoCommandPrefix).append("pattern").append( Name.Component(ProtobufTlv.encode(parameter)))) face.makeCommandInterest(interest) # Send the command interest and get the response or timeout. def onData(interest, data): # repo_command_response_pb2 was produced by protoc. response = repo_command_response_pb2.RepoCommandResponseMessage() try: ProtobufTlv.decode(response, data.content) except: dump("Cannot decode the repo command response") onFailed() if response.repo_command_response.status_code == 100: onInsertStarted() else: dump("Got repo command error code", response.repo_command_response.status_code) onFailed() def onTimeout(interest): dump("Pattern repo command timeout") onFailed() face.expressInterest(interest, onData, onTimeout)
def test_published_kdks(self): for user in self._fixture._userIdentities: kdkName = Name("/access/policy/identity/NAC/dataset/KDK") kdkName.append( self._fixture._nacIdentity.getDefaultKey().getName().get(-1)).append( "ENCRYPTED-BY").append( user.getDefaultKey().getName()) self._fixture._face.receive( Interest(kdkName).setCanBePrefix(True).setMustBeFresh(True)) self.assertTrue( self._fixture._face._sentData[0].getName().equals(kdkName), "Sent Data does not have the KDK name " + kdkName.toUri()) self._fixture._face._sentData = []
def createFreshInterest(): freshInterest = (Interest( Name("/ndn/abc")).setMustBeFresh(False).setMinSuffixComponents( 4).setMaxSuffixComponents(6).setInterestLifetimeMilliseconds( 30000).setChildSelector(1).setMustBeFresh(True)) freshInterest.getKeyLocator().setType(KeyLocatorType.KEY_LOCATOR_DIGEST) freshInterest.getKeyLocator().setKeyData( bytearray([ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F ])) freshInterest.getExclude().appendComponent(Name("abc")[0]).appendAny() return freshInterest
def onCatalogConsumeComplete(self, data, result): print "Consume complete for catalog name: " + data.getName().toUri() catalog = json.loads(result.toRawStr()) for timestamp in catalog: # For encrypted data, timestamp format will have to change rawDataName = Name(self.rawDataPrefix).append( Schedule.toIsoString(timestamp * 1000)) dataInterest = Interest(rawDataName) dataInterest.setInterestLifetimeMilliseconds(2000) dataInterest.setMustBeFresh(True) self.face.expressInterest(dataInterest, self.onRawData, self.onRawDataTimeout) self.remainingData += 1 return
def handle_completion(self): content = bytearray() for i in sorted(self.segments): segment = self.segments[i] content.extend(segment.getContent().buf()) interest = Interest(Name(self.name)) blob = Blob(content) size = blob.size() Log.info( "Received all segments ({} bytes) for interest '{}':\n{}".format( size, Util.interest_to_string(interest), urllib.parse.unquote(blob.toRawStr()))) data = Data(interest.getName()) data.setContent(blob) self.on_data(self, data)
def onAccessInterest(prefix, interest, face, interestFilterId, filter): print "On Access request interest: " + interest.getName().toUri() certInterest = Interest(interest.getName().getSubName(4)) certInterest.setName(certInterest.getName().getPrefix(-1)) certInterest.setInterestLifetimeMilliseconds(2000) face.expressInterest( certInterest, lambda memberInterest, memberData: self.onMemberCertificateData( memberInterest, memberData, interest), lambda memberInterest: self.onMemberCertificateTimeout( memberInterest, interest)) print "Retrieving member certificate: " + certInterest.getName().toUri() return
def sendInterest_to_DE(self, name): interest = Interest(name) interestName = interest.getName() interest.setInterestLifetimeMilliseconds(4000) interest.setMustBeFresh(True) #if uri not in self.outstanding: #self.outstanding[uri] = 1 # self.face.expressInterest(interest, self.onData, self._onTimeout) self.face.expressInterest( interest, None, None ) ## set None --> sent out only, don't wait for Data and Timeout print "Sent Push-Interest for %s" % interestName
async def send_temp_interest(self): """ Send a temperature interest to the producer """ interest_name = Name(self.prefix).append(str(int(time.time()) - 1)) interest = Interest(interest_name) interest.interestLifetimeMilliseconds = 4000 logging.info('Fetching {}'.format(str(interest.getName()))) print('Fetching {}'.format(str(interest.getName()))) data = await fetch_data_packet(self.face, interest) if isinstance(data, Data): self.process_temp_data(data) else: logging.info('Failed to fetch {}'.format(str(interest.getName())))
async def retx_sync_interest(self): while self.running: interest = Interest(Name(self.prefix)) interest.applicationParameters = self.encode(self.state) interest.appendParametersDigestToName() # await fetch_data_packet(self.face, interest) self.face.expressInterest(interest, self.on_sync_data) logging.info("retx") timeout = uniform(SYNC_INTERVAL_MIN, SYNC_INTERVAL_MAX) try: await asyncio.wait_for(self.sync_event.wait(), timeout) except asyncio.TimeoutError: pass self.sync_event.clear()
def _sendNextInterest(self, name): # Create an Interest using incoming name # and record it in our outstanding Interest. # Then, send the Interest out our Face. interest = Interest(name) uri = name.toUri() interest.setInterestLifetimeMilliseconds(60) interest.setMustBeFresh(True) if uri not in self.outstanding: self.outstanding[uri] = 1 self.face.expressInterest(interest, self._onData, self._onTimeout) #print ("Sent Interest for %s \n===================================" % uri) pass