M2-PT-DRP/source/behaviors/events/PeerEvent.py

15 lines
448 B
Python

from . import base
from source import packets
class PeerEvent(base.BaseEvent):
"""
Event reacting to receiving information about another machine
"""
def handle(self, packet: packets.PeerPacket, address: tuple):
# check if the peer is new
if address not in self.manager.peers:
# add the peer to the peers list
self.manager.peers[address] = packet
print("new peer discovered !")