本文整理汇总了Python中pyndn.interest.Interest.getNonce方法的典型用法代码示例。如果您正苦于以下问题:Python Interest.getNonce方法的具体用法?Python Interest.getNonce怎么用?Python Interest.getNonce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyndn.interest.Interest
的用法示例。
在下文中一共展示了Interest.getNonce方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sendSyncInterest
# 需要导入模块: from pyndn.interest import Interest [as 别名]
# 或者: from pyndn.interest.Interest import getNonce [as 别名]
def _sendSyncInterest(self):
"""
Send the sync interest for full synchronization. This forms the interest
name: /<sync-prefix>/<own-IBLT>. This cancels any pending sync interest
we sent earlier on the face.
"""
# Debug: Implement stopping an ongoing fetch.
## If we send two sync interest one after the other
## since there is no new data in the network yet,
## when data is available it may satisfy both of them
#if self._fetcher != None:
# self._fetcher.stop()
# Sync Interest format for full sync: /<sync-prefix>/<ourLatestIBF>
syncInterestName = Name(self._syncPrefix)
# Append our latest IBLT.
syncInterestName.append(self._iblt.encode())
self._outstandingInterestName = syncInterestName
# random1 is from 0.0 to 1.0.
random1 = self._systemRandom.random()
# Get a jitter of +/- syncInterestLifetime_ * 0.2 .
jitter = (random1 - 0.5) * (self._syncInterestLifetime * 0.2)
self._face.callLater(
self._syncInterestLifetime / 2 + jitter, self._sendSyncInterest)
syncInterest = Interest(syncInterestName)
syncInterest.setInterestLifetimeMilliseconds(self._syncInterestLifetime)
syncInterest.refreshNonce()
SegmentFetcher.fetch(
self._face, syncInterest, None,
lambda content: self._onSyncData(content, syncInterest),
FullPSync2017._onError)
logging.getLogger(__name__).debug("sendFullSyncInterest, nonce: " +
syncInterest.getNonce().toHex() + ", hash: " +
str(abs(hash(syncInterestName))))