diff --git a/src/smbprotocol/connection.py b/src/smbprotocol/connection.py index b1c06e0..93320ab 100644 --- a/src/smbprotocol/connection.py +++ b/src/smbprotocol/connection.py @@ -953,7 +953,7 @@ def disconnect(self, close=True, timeout=None): log.info("Disconnecting transport connection") self.transport.close() - if self._t_worker: + if self._t_worker and self._t_worker.ident != threading.get_ident(): self._t_worker.join(timeout=2) def send( diff --git a/src/smbprotocol/transport.py b/src/smbprotocol/transport.py index 2288239..9f5cd9a 100644 --- a/src/smbprotocol/transport.py +++ b/src/smbprotocol/transport.py @@ -145,7 +145,7 @@ def _recv(self, length, timeout): except OSError as e: # Windows will raise this error if the socket has been shutdown, Linux return returns an empty byte # string so we just replicate that. - if e.errno not in [errno.ESHUTDOWN, errno.ECONNRESET]: + if e.errno not in [errno.ESHUTDOWN, errno.ECONNRESET, errno.ECONNABORTED]: # Avoid collecting coverage here to avoid CI failing due to race condition differences raise # pragma: no cover b_data = b""