python-trio / python-trio/trio
Discussion: should there be a way to set early socket options in the high-level interface?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 431
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 6
Description
Specifically, should there be a way to issue arbitrary setsockopt calls in open_tcp_stream and open_tcp_listeners, before the socket is bound by calling connect or bind?
For example, you might want to set SO_REUSEPORT.
The argument against would be that this makes the API more complicated for an obscure and rarely used feature that's better handled by dropping down to the socket layer.
OTOH the high-level API has some actual value in it; dropping down to the socket layer while replicated its functionality is not trivial.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the high-level open_tcp_stream and open_tcp_listeners interfaces and the underlying socket-layer path they wrap. Investigate how setsockopt, including SO_REUSEPORT, would need to be exposed before connect or bind. Done means reaching a clear API decision and documenting or implementing the agreed behavior, with validation for both entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100