Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 fixes for adafruit_esp32spi_socket.socket #44

Merged
merged 1 commit into from
May 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion adafruit_esp32spi/adafruit_esp32spi_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def connect(self, address, conntype=None):
a hostname string). 'conntype' is an extra that may indicate SSL or not,
depending on the underlying interface"""
host, port = address
if conntype is None:
conntype = _the_interface.TCP_MODE
if not _the_interface.socket_connect(self._socknum, host, port, conn_mode=conntype):
raise RuntimeError("Failed to connect to host", host)
self._buffer = b''
Expand Down Expand Up @@ -123,7 +125,7 @@ def read(self, size=0):
received.append(recv)
to_read -= len(recv)
gc.collect()
if time.monotonic() - stamp > self._timeout:
if self._timeout > 0 and time.monotonic() - stamp > self._timeout:
break
#print(received)
self._buffer += b''.join(received)
Expand Down