def updatedState(self):
"""Call this whenever the resource was updated, and a notification
should be sent to observers."""
# this implements the second implementation suggestion from
# draft-ietf-coap-observe-11 section 4.4
#
## @TODO handle situations in which this gets called more often than
# 2^32 times in 256 seconds (or document why we can be sure that
# that will not happen)
self.observe_index = (self.observe_index + 1) % (2**24)
for o in self.observers.values():
o.trigger()
评论列表
文章目录