Mercurial > crates > systemd-socket
comparison tests/ordinary.rs @ 4:66c0e10c89fc
Support resolving hostnames
Until now the crate supported only IP addresses and systemd sockets.
This was troublesome because it prevented the popular `localhost:1234`
format. This commit changes the behavior so that if parsing of
`std::net::SocketAddr` fails it attempts to parse it as `hostname:port`.
`bind_*()` methods were also modified to be async because of this.
author | Martin Habovstiak <martin.habovstiak@gmail.com> |
---|---|
date | Fri, 27 Nov 2020 15:05:19 +0100 |
parents | ef8bf41097ac |
children | cfef4593e207 |
comparison
equal
deleted
inserted
replaced
3:0edcde404b02 | 4:66c0e10c89fc |
---|---|
5 mod comm; | 5 mod comm; |
6 | 6 |
7 enum Test {} | 7 enum Test {} |
8 | 8 |
9 impl comm::Test for Test { | 9 impl comm::Test for Test { |
10 const SOCKET_ADDR: &'static str = "127.0.0.1:4242"; | 10 const SOCKET_ADDR: &'static str = "localhost:4242"; |
11 | 11 |
12 fn spawn_slave(program_name: &OsStr) -> io::Result<Child> { | 12 fn spawn_slave(program_name: &OsStr) -> io::Result<Child> { |
13 Command::new(program_name) | 13 Command::new(program_name) |
14 .env("SYSTEMD_SOCKET_INTEGRATION_TEST", "slave") | 14 .env("SYSTEMD_SOCKET_INTEGRATION_TEST", "slave") |
15 .spawn() | 15 .spawn() |