Skip to content

Conversation

@SuperFluffy
Copy link
Contributor

This patch adds a Server::bind_tcp method
returning a BoundTcpServer server to query
the local address the server is bound to.

To avoid clashing on occupied ports, blackbox
tests bind to the zero-port (as in 0.0.0.0:0)
and are assigned a random free port by the system.

Because the Server::listen_tcp method binds
and accepts a port in one go, it is currently not
possible to programmatically return the port the
server bound.

With this patch binding a port and accepting
requests is split into a Server::bind_tcp and
BoundTcpServer::accept. Server::listen_tcp is
implemented in terms of these.

This is only implemented for the v0.38 server.
If the direction is acceptable I can extend this
to the other servers.

This patch adds a `Server::bind_tcp` method
returning a `BoundTcpServer` server to query
the local address the server is bound to.

To avoid clashing on occupied ports, blackbox
tests bind to the zero-port (as in `0.0.0.0:0`)
and are assigned a random free port by the system.

Because the `Server::listen_tcp` method binds
and accepts a port in one go, it is currently not
possible to programmatically return the port the
server bound.

With this patch binding a port and accepting
requests is split into a `Server::bind_tcp` and
`BoundTcpServer::accept`. `Server::listen_tcp` is
implemented in terms of these.
@SuperFluffy
Copy link
Contributor Author

It looks like CI failed due to unrelated clippy lints (similar to other open PRs that fail due to clippy).

@erwanor erwanor self-requested a review December 25, 2024 20:12
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.

1 participant