in qpid/connection.py [0:0]
def run(self):
frame_dec = FrameDecoder()
seg_dec = SegmentDecoder()
op_dec = OpDecoder()
while not self.closed:
try:
data = self.sock.recv(64*1024)
if not data:
self.detach_all()
break
# If we have a security layer and it sends us no decoded data,
# that's OK as long as its return code is happy.
if self.security_layer_rx:
try:
data = self.security_layer_rx.decode(data)
except:
self.detach_all()
break
# When we do not use SSL transport, we get periodic
# spurious timeout events on the socket. When using SSL,
# these events show up as timeout *errors*. Both should be
# ignored unless we have aborted.
except socket.timeout:
if self.aborted():
self.close_code = (None, "connection timed out")
self.detach_all()
break
else:
continue
except socket.error as e:
if self.aborted() or str(e) != "The read operation timed out":
self.close_code = (None, str(e))
self.detach_all()
break
else:
continue
frame_dec.write(data)
seg_dec.write(*frame_dec.read())
op_dec.write(*seg_dec.read())
for op in op_dec.read():
try:
self.delegate.received(op)
except Closed as e:
self.close_code = (None, str(e))
if not self.opened:
self.failed = True
self.closed = True
notify(self.condition)
self.sock.close()