def read_from_fd(self):
if self._ssl_accepting:
return None
try:
chunk = self.socket.read(self.read_chunk_size)
except SSL.WantReadError:
return None
except SSL.ZeroReturnError:
self.close(exc_info=True)
return None
except SSL.SysCallError as e:
err_num = abs(e[0])
if err_num in (errno.EWOULDBLOCK, errno.EAGAIN):
return None
# NOTE: We will handle the self.close in here.
# _read_to_buffer of BaseIOStream will not chceck SSL.SysCallError
if err_num == errno.EPERM:
self.close(exc_info=True)
return None
self.close(exc_info=True)
raise
# NOTE: Just in case we missed some SSL Error type.
except SSL.Error as e:
raise
if not chunk:
self.close()
return None
return chunk
评论列表
文章目录