diff options
author | Rob Gaddi <rgaddi@highlandtechnology.com> | 2019-06-20 16:28:46 -0700 |
---|---|---|
committer | Rob Gaddi <rgaddi@highlandtechnology.com> | 2019-06-20 16:28:46 -0700 |
commit | 53d2273432a3dd32646c043f4c67b26ef2d1016b (patch) | |
tree | f1310602cc88069f62a6feeb6ba5cc11292dfdc8 | |
parent | 3215eb3088a4ca55c5217c2e99da5584c3ee02c1 (diff) | |
download | pyserial-git-53d2273432a3dd32646c043f4c67b26ef2d1016b.tar.gz |
Fixed flush_input_buffer() for situations where the remote end has closed
the socket.
-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 |