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

Change Cython API to truncate data upon reception.

parent a814a35b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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")
+2 −2
Original line number Diff line number Diff line
@@ -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