Read the correct number of bytes from kafka.
According to the protocol documentation, the 4 byte integer at the beginning of a response represents the size of the payload only, not including those bytes. See http://goo.gl/rg5uom
This commit is contained in:
@@ -55,12 +55,11 @@ class KafkaConnection(local):
|
||||
self._raise_connection_error()
|
||||
(size,) = struct.unpack('>i', resp)
|
||||
|
||||
messagesize = size - 4
|
||||
log.debug("About to read %d bytes from Kafka", messagesize)
|
||||
log.debug("About to read %d bytes from Kafka", size)
|
||||
|
||||
# Read the remainder of the response
|
||||
total = 0
|
||||
while total < messagesize:
|
||||
while total < size:
|
||||
resp = self._sock.recv(self.bufsize)
|
||||
log.debug("Read %d bytes from Kafka", len(resp))
|
||||
if resp == "":
|
||||
|
||||
Reference in New Issue
Block a user