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

espressif: add user-specified socket connect() timeout #9210

Merged
merged 1 commit into from May 1, 2024

Conversation

dhalbert
Copy link
Collaborator

In espressif, adds user-specified socket connect() timeout by doing connect() on the non-blocking socket, and then polling with select() for success.

RP2040 CYW43 already has similar code (though it doesn't check for ctrl-C or do background tasks)

Tested with adafruit_requests. IMPORTANT: adafruit_requests tries to connect twice, which can make the timeout appear to be twice as long. This is an issue with adafruit_requests, not with this fix. I will bring this up as an issue in that library.

Tagging @SanJoseBart and @bitmitt who were in the #8266 discussion.

@dhalbert dhalbert requested review from tannewt and jepler April 26, 2024 17:48
@dhalbert
Copy link
Collaborator Author

The mixgo_ce_udisk build failure is a space issue, and will be fixed by #9207, so that failure can be ignored here.

@SanJoseBart
Copy link

Thank you @dhalbert! This will be a very useful improvement!

@justmobilize
Copy link

@dhalbert using the test code you posted in the requests issue:

On: Adafruit CircuitPython 9.1.0-beta.1-12-g2060b2b390 on 2024-04-26; Adafruit Feather ESP32-S3 TFT with ESP32S3:

default success: 0.632004
default fail: 36.632
error: Error connecting socket: [Errno 119] EINPROGRESS
timeout success: 0.641022
timeout fail: 6.16202
error: Error connecting socket: [Errno 116] ETIMEDOUT

On: Adafruit CircuitPython 9.1.0-beta.1-12-g2060b2b390 on 2024-04-26; Adafruit Feather ESP32-S2 TFT with ESP32S2:

default success: 0.694092
default fail: 0.00390625
error:
timeout success: 0.704956
timeout fail: 0.00402832

So something seems not quite right...

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
Copy link
Member

tannewt commented Apr 29, 2024

One board is too big.

@dhalbert dhalbert merged commit 49954d8 into adafruit:main May 1, 2024
192 of 193 checks passed
@dhalbert dhalbert deleted the socket-timeout branch May 1, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCP Connection Timeout Setting
4 participants