reapired multicast
This commit is contained in:
parent
850b4ed78b
commit
f8fa48f274
|
@ -26,6 +26,3 @@ sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP, mreq)
|
||||||
data, addr = sock.recvfrom(1024)
|
data, addr = sock.recvfrom(1024)
|
||||||
print(data)
|
print(data)
|
||||||
print(addr[0], addr[1])
|
print(addr[0], addr[1])
|
||||||
|
|
||||||
time.sleep(3)
|
|
||||||
sock.sendto("hello world".encode('utf-8'), ("addr[0]", int(addr[1])))
|
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ class User(Peer):
|
||||||
"""
|
"""
|
||||||
Receive a packet from the multicast and translate it into a Python object.
|
Receive a packet from the multicast and translate it into a Python object.
|
||||||
"""
|
"""
|
||||||
data, addr = self.receive_raw_data()
|
data, addr = self.receive_multicast()
|
||||||
peer = self.find_peer(addr[0], addr[1])
|
peer = self.find_peer(addr[0], addr[1])
|
||||||
try:
|
try:
|
||||||
pkt = Packet.unmarshal(data)
|
pkt = Packet.unmarshal(data)
|
||||||
|
@ -1147,7 +1147,7 @@ class PeerManager(Thread):
|
||||||
self.last_neighbour = time.time()
|
self.last_neighbour = time.time()
|
||||||
|
|
||||||
# For the multicast discovery : send a hello every minute.
|
# For the multicast discovery : send a hello every minute.
|
||||||
if time.time() - self.last_multicast > 60:
|
if time.time() - self.last_multicast > 10: #60:
|
||||||
self.user.send_hello_multicast()
|
self.user.send_hello_multicast()
|
||||||
self.last_multicast = time.time()
|
self.last_multicast = time.time()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue