当前位置: 首页>>代码示例>>Python>>正文


Python Interest.setLinkWireEncoding方法代码示例

本文整理汇总了Python中pyndn.interest.Interest.setLinkWireEncoding方法的典型用法代码示例。如果您正苦于以下问题:Python Interest.setLinkWireEncoding方法的具体用法?Python Interest.setLinkWireEncoding怎么用?Python Interest.setLinkWireEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyndn.interest.Interest的用法示例。


在下文中一共展示了Interest.setLinkWireEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _sendKeyInterest

# 需要导入模块: from pyndn.interest import Interest [as 别名]
# 或者: from pyndn.interest.Interest import setLinkWireEncoding [as 别名]
    def _sendKeyInterest(self, interest, timeSlot, onEncryptedKeys, onError):
        """
        Send an interest with the given name through the face with callbacks to
          _handleCoveringKey, _handleTimeout and _handleNetworkNack.

        :param Interest interest: The interest to send.
        :param float timeSlot: The time slot, passed to _handleCoveringKey,
          _handleTimeout and _handleNetworkNack.
        :param onEncryptedKeys: The OnEncryptedKeys callback, passed to
          _handleCoveringKey, _handleTimeout and _handleNetworkNack.
        :type onEncryptedKeys: function object
        :param onError: This calls onError(errorCode, message) for an error.
        :type onError: function object
        """

        def onKey(interest, data):
            self._handleCoveringKey(interest, data, timeSlot, onEncryptedKeys, onError)

        def onTimeout(interest):
            self._handleTimeout(interest, timeSlot, onEncryptedKeys, onError)

        def onNetworkNack(interest, networkNack):
            self._handleNetworkNack(interest, networkNack, timeSlot, onEncryptedKeys, onError)

        if self._keyRetrievalLink.getDelegations().size() == 0:
            # We can use the supplied interest without copying.
            request = interest
        else:
            # Copy the supplied interest and add the Link.
            request = Interest(interest)
            # This will use a cached encoding if available.
            request.setLinkWireEncoding(self._keyRetrievalLink.wireEncode())

        self._face.expressInterest(request, onKey, onTimeout, onNetworkNack)
开发者ID:named-data,项目名称:PyNDN2,代码行数:36,代码来源:producer.py


注:本文中的pyndn.interest.Interest.setLinkWireEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。