From 6aa714ef4c22491630cd4c4d9aa296dc48b6747d Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Sat, 9 Jan 2021 21:32:17 +0100 Subject: [PATCH] Cleaning files. --- squinnondation/messages.py | 15 +++++++-------- squinnondation/peers.py | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/squinnondation/messages.py b/squinnondation/messages.py index bc427a5..ea64227 100644 --- a/squinnondation/messages.py +++ b/squinnondation/messages.py @@ -32,7 +32,6 @@ class TLV: """ Ensure that the TLV is well-formed. Raises a ValueError if it is not the case. - TODO: Make some tests """ return True @@ -76,7 +75,7 @@ class Pad1TLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your Pad1TLV. Please say Hello to me before."))) return user.add_system_message("I received a Pad1TLV, how disapointing.") @@ -126,7 +125,7 @@ class PadNTLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your PadNTLV. Please say Hello to me before."))) return user.add_system_message(f"I received {self.length} zeros.") @@ -242,7 +241,7 @@ class NeighbourTLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your NeighbourTLV. Please say Hello to me before."))) return if (self.ip_address, self.port) in user.addresses: @@ -301,7 +300,7 @@ class DataTLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your DataTLV. Please say Hello to me before."))) return if 0 in self.data: @@ -376,7 +375,7 @@ class AckTLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your AckTLV. Please say Hello to me before."))) return user.add_system_message(f"I received an AckTLV from {sender}") @@ -421,13 +420,13 @@ class GoAwayTLV(TLV): if not sender.active or not sender.symmetric or not sender.id: # It doesn't say hello, we don't listen to it user.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 won't listen to your GoAwayTLV. Please say Hello to me before."))) return if sender.active: sender.active = False user.update_peer_table(sender) - user.add_system_message("Some told me that he went away : " + self.message) + user.add_system_message("Someone told me that he went away : " + self.message) @staticmethod def construct(ga_type: GoAwayType, message: str) -> "GoAwayTLV": diff --git a/squinnondation/peers.py b/squinnondation/peers.py index e20701d..51f254d 100644 --- a/squinnondation/peers.py +++ b/squinnondation/peers.py @@ -1203,7 +1203,6 @@ class Message: This is useful to check unicity or to save and load messages. """ content: str - # TODO: Replace the id by the good (potential) peer sender_id: int nonce: int created_at: datetime