diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-05-31 01:33:12 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-05-31 01:33:12 +0000 |
commit | d0f8df1b85a744e55026296c4ea1a8061b93d3a5 (patch) | |
tree | fc5a3d0a4298161d2199494fb1019c8b269efa6d /serial/urlhandler/protocol_socket.py | |
parent | 7816a6a659f0434770edf47d15d0ee24add3b04f (diff) | |
download | pyserial-d0f8df1b85a744e55026296c4ea1a8061b93d3a5.tar.gz |
[Bug pyserial:135] reading from socket with timeout=None causes TypeError
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@460 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'serial/urlhandler/protocol_socket.py')
-rw-r--r-- | serial/urlhandler/protocol_socket.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/serial/urlhandler/protocol_socket.py b/serial/urlhandler/protocol_socket.py index ccf7e14..0c96511 100644 --- a/serial/urlhandler/protocol_socket.py +++ b/serial/urlhandler/protocol_socket.py @@ -135,8 +135,11 @@ class SocketSerial(SerialBase): until the requested number of bytes is read.""" if not self._isOpen: raise portNotOpenError data = bytearray() - timeout = time.time() + self._timeout - while len(data) < size and time.time() < timeout: + if self._timeout is not None: + timeout = time.time() + self._timeout + else: + timeout = None + while len(data) < size and (timeout is None or time.time() < timeout): try: # an implementation with internal buffer would be better # performing... |