-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add option to create reusable sockets #3
Comments
@tannewt do you think this would be a good idea? Where we set the timeout, we could also check the CP version and if it's greater than 9, set this option |
I've been wrestling with trying to understand the socket reuse issue, there's a lot of history in the core issues and PRs, and a lot of unclear info out on the ethers. My understanding is that |
Yes, Server examples that set |
Ahh, so we wouldn't add that here, unless we added support for getting server-side sockets in connection manager |
I was actually wondering about that this morning... was going to see if CM meshed with adafruit_http_server. |
That does not seem necessary to me. I would suggest closing this issue unless, @bablokb, you have a particular use case in mind. The point of connection manager to me is to wrap and hide the multiple sources of socket pools and ssl contexts. |
Thanks for the clarification, it was not clear for me that this is not an issue for the client side. |
According to the release-notes for CP 9.0.0:
socket.setsockopt(pool.SOL_SOCKET, pool.SO_REUSEADDR, 1)
, as in CPython.you have to explicitly mark sockets for reuse. Currently, user code has to create a session, call
get
and then manipulate the socket from theResponse
-object.I think it would be much simpler to have this rather low-level manipulation of sockets as part of ConnectionManager. Or even better, as part of
socketpool
as the factory of sockets. But the latter would need changes to CP itself.The text was updated successfully, but these errors were encountered: