Update tcp_transport.py

Counter before send, in case of fail send, will not result error 500 random_id_duplicate
This commit is contained in:
LiemCH 2016-10-09 10:10:41 +07:00 committed by GitHub
parent 6a32c6cd7a
commit 38bf460930

View File

@ -28,8 +28,8 @@ class TcpTransport:
crc = crc32(writer.get_bytes()) crc = crc32(writer.get_bytes())
writer.write_int(crc, signed=False) writer.write_int(crc, signed=False)
self.tcp_client.write(writer.get_bytes())
self.send_counter += 1 self.send_counter += 1
self.tcp_client.write(writer.get_bytes())
def receive(self, timeout=timedelta(seconds=5)): def receive(self, timeout=timedelta(seconds=5)):
"""Receives a TCP message (tuple(sequence number, body)) from the connected peer. """Receives a TCP message (tuple(sequence number, body)) from the connected peer.