diff --git a/python/opendht.pyx b/python/opendht.pyx index 790b3e661ba61bfe76ba7c35f903e6b94a178e07..4ea8e49024903d582901b87e7bcc0aa898346d19 100644 --- a/python/opendht.pyx +++ b/python/opendht.pyx @@ -139,6 +139,12 @@ cdef class SockAddr(object): return self._addr.setPort(port) def setFamily(SockAddr self, cpp.sa_family_t af): return self._addr.setFamily(af) + def isLoopback(SockAddr self): + return self._addr.isLoopback() + def isPrivate(SockAddr self): + return self._addr.isPrivate() + def isUnspecified(SockAddr self): + return self._addr.isUnspecified() def __str__(self): return self.toString().decode() def __repr__(self): diff --git a/python/opendht_cpp.pxd b/python/opendht_cpp.pxd index 3b8899710b079d15bddf9ed89e227b2c7a3d4819..01cc474708f921a9dfba97ca8f71734eae28dd6e 100644 --- a/python/opendht_cpp.pxd +++ b/python/opendht_cpp.pxd @@ -77,6 +77,9 @@ cdef extern from "opendht/sockaddr.h" namespace "dht": void setPort(in_port_t p) sa_family_t getFamily() const void setFamily(sa_family_t f) + bool isLoopback() const + bool isPrivate() const + bool isUnspecified() const ctypedef vector[uint8_t] Blob diff --git a/python/tools/pingpong.py b/python/tools/pingpong.py index b7db74e5b32b86a81c7df725f50eb07684855886..4634f59a84cc5391f39ebdca08386a9e1651a01e 100755 --- a/python/tools/pingpong.py +++ b/python/tools/pingpong.py @@ -51,7 +51,7 @@ def ping(node, h): def pong(node, h): print(node.getNodeId().decode(), "got ping", h, i) - loop.call_soon_threadsafe(ping, node, h); + loop.call_soon_threadsafe(ping, node, h) return True ping_node.listen(loc_ping, lambda v: pong(pong_node, loc_pong))