Skip to content

Conversation

@codemaestro64
Copy link
Contributor

What was wrong?

Closes #726

Passing a trio.Nursery into listen() was messy. It forced the Swarm to micro-manage the lifecycle of every transport listener, which leaked implementation details and made the API awkward to use. Simply put, the Swarm was doing work that the Listener should have been doing itself.

How was it fixed?

This PR moves the nursery management inside the listeners.

Instead of asking for a nursery, TCPListener, WebsocketListener, and QUICListener now spin up their own internal nurseries using system tasks. This keeps the concurrency logic encapsulated where it belongs.

Changes:

  • Cleaner API: The nursery argument was dropped from IListener.listen(maddr).
  • Self-contained Transports: Listeners now handle their own background loops. Crucially, this PR ensures close() properly cancels these internal tasks so we don't leave orphans hanging around.

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.

2 participants