Add size and correlation id decoding to try/except block in BrokerConnection
This commit is contained in:
@@ -88,12 +88,13 @@ class BrokerConnection(local):
|
|||||||
# instead we read directly from the socket fd buffer
|
# instead we read directly from the socket fd buffer
|
||||||
# alternatively, we could read size bytes into a separate buffer
|
# alternatively, we could read size bytes into a separate buffer
|
||||||
# and decode from that buffer (and verify buffer is empty afterwards)
|
# and decode from that buffer (and verify buffer is empty afterwards)
|
||||||
size = Int32.decode(self._read_fd)
|
|
||||||
recv_correlation_id = Int32.decode(self._read_fd)
|
|
||||||
assert correlation_id == recv_correlation_id
|
|
||||||
try:
|
try:
|
||||||
|
size = Int32.decode(self._read_fd)
|
||||||
|
recv_correlation_id = Int32.decode(self._read_fd)
|
||||||
|
if correlation_id != recv_correlation_id:
|
||||||
|
raise RuntimeError('Correlation ids do not match!')
|
||||||
response = response_type.decode(self._read_fd)
|
response = response_type.decode(self._read_fd)
|
||||||
except socket.error as e:
|
except (RuntimeError, socket.error) as e:
|
||||||
log.exception("Error in BrokerConnection.recv()")
|
log.exception("Error in BrokerConnection.recv()")
|
||||||
self.close()
|
self.close()
|
||||||
return None
|
return None
|
||||||
|
Reference in New Issue
Block a user