diff options
-rw-r--r-- | kafka/conn.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index cd79e7f..ce2487e 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -533,7 +533,9 @@ class BrokerConnection(object): # establishes a security context, or it needs further token exchange. # The gssapi will be able to identify the needed next step. # The connection is closed on failure. - response = self._sock.recv(2000) + header = self._sock.recv(4) + token_size = struct.unpack('>i', header) + received_token = self._sock.recv(token_size) self._sock.setblocking(False) except ConnectionError as e: @@ -542,13 +544,6 @@ class BrokerConnection(object): self.close(error=error) return future.failure(error) - # pass the received token back to gssapi, strip the first 4 bytes - # dpkp note: what are the first four bytes here? - # it seems likely that this is the encoded message size - # which we should receive and parse first, then use to parse - # the remainder of the token - received_token = response[4:] - except Exception as e: return future.failure(e) |