diff options
author | zsquareplusc <cliechti@gmx.net> | 2019-06-21 15:11:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 15:11:18 +0200 |
commit | f620b4727b67c968ba27a601ad76b57d2369f6d4 (patch) | |
tree | f1310602cc88069f62a6feeb6ba5cc11292dfdc8 | |
parent | acab9d2c0efb63323faebfd5e3405d77cd4b5617 (diff) | |
parent | 53d2273432a3dd32646c043f4c67b26ef2d1016b (diff) | |
download | pyserial-git-f620b4727b67c968ba27a601ad76b57d2369f6d4.tar.gz |
Merge pull request #441 from NJDFan/master
reset_input_buffer() can hang on sockets
-rw-r--r-- | serial/urlhandler/protocol_socket.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/serial/urlhandler/protocol_socket.py b/serial/urlhandler/protocol_socket.py index 36cdf1f..11f6a05 100644 --- a/serial/urlhandler/protocol_socket.py +++ b/serial/urlhandler/protocol_socket.py @@ -249,7 +249,8 @@ class Serial(SerialBase): while ready: ready, _, _ = select.select([self._socket], [], [], 0) try: - self._socket.recv(4096) + if ready: + ready = self._socket.recv(4096) except OSError as e: # this is for Python 3.x where select.error is a subclass of # OSError ignore BlockingIOErrors and EINTR. other errors are shown |