Skip to main content
Sign in
Snippets Groups Projects
Commit 3309bc3e authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Print when sending as well.

parent 7df8c063
Branches packetdebug
No related tags found
No related merge requests found
...@@ -378,6 +378,11 @@ class ExtCtrl(object): ...@@ -378,6 +378,11 @@ class ExtCtrl(object):
while self.cookie == None: while self.cookie == None:
self.cond.wait(1) self.cond.wait(1)
def send(self, data):
if self.packetdebug:
print "Sending", Packet(data)
self.ethernet.send(data)
def send_INIT(self): def send_INIT(self):
flags = kind_INIT | flag_NEED_ACK flags = kind_INIT | flag_NEED_ACK
fragmenter = Fragmenter(destination=self.other, fragmenter = Fragmenter(destination=self.other,
...@@ -387,7 +392,7 @@ class ExtCtrl(object): ...@@ -387,7 +392,7 @@ class ExtCtrl(object):
index=self.local_index) index=self.local_index)
for i in self.retries(self.local_index): for i in self.retries(self.local_index):
for f in fragmenter.fragments(max_length=self.max_length): for f in fragmenter.fragments(max_length=self.max_length):
self.ethernet.send(f.getvalue()) self.send(f.getvalue())
self.next_index() self.next_index()
def send_INIT_ACK(self): def send_INIT_ACK(self):
...@@ -399,7 +404,7 @@ class ExtCtrl(object): ...@@ -399,7 +404,7 @@ class ExtCtrl(object):
index=self.remote_index) index=self.remote_index)
fragmenter.encode_uint32(self.local_index) fragmenter.encode_uint32(self.local_index)
for f in fragmenter.fragments(max_length=self.max_length): for f in fragmenter.fragments(max_length=self.max_length):
self.ethernet.send(f.getvalue()) self.send(f.getvalue())
def send_ACK(self, packet): def send_ACK(self, packet):
flags = packet.kind | flag_IS_ACK flags = packet.kind | flag_IS_ACK
...@@ -409,7 +414,7 @@ class ExtCtrl(object): ...@@ -409,7 +414,7 @@ class ExtCtrl(object):
cookie=packet.cookie, cookie=packet.cookie,
index=packet.index) index=packet.index)
for f in fragmenter.fragments(max_length=self.max_length): for f in fragmenter.fragments(max_length=self.max_length):
self.ethernet.send(f.getvalue()) self.send(f.getvalue())
def send_DATA_with_ack(self, data): def send_DATA_with_ack(self, data):
flags = kind_DATA | flag_NEED_ACK flags = kind_DATA | flag_NEED_ACK
...@@ -421,7 +426,7 @@ class ExtCtrl(object): ...@@ -421,7 +426,7 @@ class ExtCtrl(object):
fragmenter.write(data) fragmenter.write(data)
for i in self.retries(self.local_index): for i in self.retries(self.local_index):
for f in fragmenter.fragments(max_length=self.max_length): for f in fragmenter.fragments(max_length=self.max_length):
self.ethernet.send(f.getvalue()) self.send(f.getvalue())
self.next_index() self.next_index()
def send_DATA(self, data): def send_DATA(self, data):
...@@ -433,7 +438,7 @@ class ExtCtrl(object): ...@@ -433,7 +438,7 @@ class ExtCtrl(object):
index=self.local_index) index=self.local_index)
fragmenter.write(data) fragmenter.write(data)
for f in fragmenter.fragments(max_length=self.max_length): for f in fragmenter.fragments(max_length=self.max_length):
self.ethernet.send(f.getvalue()) self.send(f.getvalue())
self.next_index() self.next_index()
def writer(self): def writer(self):
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment