fixed wrong naming (query/response confusion)

This commit is contained in:
Bora M. Alper 2017-06-17 15:18:17 +03:00
parent e624837059
commit 0c6d01184b

View File

@ -181,7 +181,7 @@ class SybilNode(asyncio.DatagramProtocol):
except (TypeError, KeyError, AssertionError): except (TypeError, KeyError, AssertionError):
return return
data = self.__build_GET_PEERS_query( data = self.__build_GET_PEERS_response(
info_hash[:15] + self.__true_id[:5], transaction_id, self.__calculate_token(addr, info_hash) info_hash[:15] + self.__true_id[:5], transaction_id, self.__calculate_token(addr, info_hash)
) )
@ -213,7 +213,7 @@ class SybilNode(asyncio.DatagramProtocol):
except (TypeError, KeyError, AssertionError): except (TypeError, KeyError, AssertionError):
return return
data = self.__build_ANNOUNCE_PEER_query(node_id[:15] + self.__true_id[:5], transaction_id) data = self.__build_ANNOUNCE_PEER_response(node_id[:15] + self.__true_id[:5], transaction_id)
self.sendto(data, addr) self.sendto(data, addr)
if implied_port: if implied_port:
@ -359,7 +359,7 @@ class SybilNode(asyncio.DatagramProtocol):
) )
@staticmethod @staticmethod
def __build_GET_PEERS_query(id_: bytes, transaction_id: bytes, token: bytes) -> bytes: # pylint: disable=invalid-name def __build_GET_PEERS_response(id_: bytes, transaction_id: bytes, token: bytes) -> bytes: # pylint: disable=invalid-name
""" Reference Implementation: """ Reference Implementation:
bencode.dumps({ bencode.dumps({
@ -378,7 +378,7 @@ class SybilNode(asyncio.DatagramProtocol):
) )
@staticmethod @staticmethod
def __build_ANNOUNCE_PEER_query(id_: bytes, transaction_id: bytes) -> bytes: # pylint: disable=invalid-name def __build_ANNOUNCE_PEER_response(id_: bytes, transaction_id: bytes) -> bytes: # pylint: disable=invalid-name
""" Reference Implementation: """ Reference Implementation:
bencode.dumps({ bencode.dumps({