Banned clients are not potential clients

This commit is contained in:
Yohann D'ANELLO 2021-01-05 21:50:16 +01:00
parent 1db72e71dc
commit eb0098552a
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 6 additions and 6 deletions

View File

@ -73,7 +73,7 @@ class Pad1TLV(TLV):
return self.type.to_bytes(1, sys.byteorder) return self.type.to_bytes(1, sys.byteorder)
def handle(self, squirrel: Any, sender: Any) -> None: def handle(self, squirrel: Any, sender: Any) -> None:
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your Pad1TLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your Pad1TLV. Please say me Hello before.")))
@ -123,7 +123,7 @@ class PadNTLV(TLV):
+ self.mbz[:self.length] + self.mbz[:self.length]
def handle(self, squirrel: Any, sender: Any) -> None: def handle(self, squirrel: Any, sender: Any) -> None:
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your PadNTLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your PadNTLV. Please say me Hello before.")))
@ -239,7 +239,7 @@ class NeighbourTLV(TLV):
self.port.to_bytes(2, sys.byteorder) self.port.to_bytes(2, sys.byteorder)
def handle(self, squirrel: Any, sender: Any) -> None: def handle(self, squirrel: Any, sender: Any) -> None:
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your NeighbourTLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your NeighbourTLV. Please say me Hello before.")))
@ -295,7 +295,7 @@ class DataTLV(TLV):
""" """
A message has been sent. We log it. A message has been sent. We log it.
""" """
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your DataTLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your DataTLV. Please say me Hello before.")))
@ -364,7 +364,7 @@ class AckTLV(TLV):
""" """
When an AckTLV is received, we know that we do not have to inundate that neighbour anymore. When an AckTLV is received, we know that we do not have to inundate that neighbour anymore.
""" """
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your AckTLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your AckTLV. Please say me Hello before.")))
@ -409,7 +409,7 @@ class GoAwayTLV(TLV):
self.message.encode("UTF-8")[:self.length - 1] self.message.encode("UTF-8")[:self.length - 1]
def handle(self, squirrel: Any, sender: Any) -> None: def handle(self, squirrel: Any, sender: Any) -> None:
if not sender.active or not sender.id: if not sender.active or not sender.symmetric or not sender.id:
# It doesn't say hello, we don't listen to it # It doesn't say hello, we don't listen to it
squirrel.send_packet(sender, Packet.construct(WarningTLV.construct( squirrel.send_packet(sender, Packet.construct(WarningTLV.construct(
"You are not my neighbour, I don't listen to your GoAwayTLV. Please say me Hello before."))) "You are not my neighbour, I don't listen to your GoAwayTLV. Please say me Hello before.")))