Commit 90aeb210 authored by Andreas Schmidt's avatar Andreas Schmidt

Change Cython API to truncate data upon reception.

parent a814a35b
Pipeline #823 passed with stages
in 56 seconds
......@@ -86,7 +86,7 @@ cdef class PrrtSocket:
cdef int32_t len
with nogil:
len = cprrt.PrrtSocket_recv(self._c_socket, <void*> buffer)
return len, buffer
return buffer[:len]
def connect(self, host, port):
cdef bytes encodedHost = host.encode("utf-8")
......
......@@ -22,8 +22,8 @@ class ReceiverThread(threading.Thread):
def run(self):
while(1):
len, data = self.sock.recv()
v = data[:len].decode('UTF-8')
data = self.sock.recv()
v = data.decode('UTF-8')
seqno = v[:self.seqnoDigits]
if seqno in self.received:
self.duplicates = self.duplicates + 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment