diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-22 18:38:59 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-24 16:24:09 -0700 |
| commit | 6328f7c199a1697aaee7e5fe2b397c457e6c311a (patch) | |
| tree | 21b8afe559302ed90be9dbb725c700513d9cfe7b /src/libstd/rt | |
| parent | 67ee480936947aa5b1953b7b6e48a0c7a191501e (diff) | |
| download | rust-6328f7c199a1697aaee7e5fe2b397c457e6c311a.tar.gz rust-6328f7c199a1697aaee7e5fe2b397c457e6c311a.zip | |
std: Add timeouts to unix connect/accept
This adds support for connecting to a unix socket with a timeout (a named pipe on windows), and accepting a connection with a timeout. The goal is to bring unix pipes/named sockets back in line with TCP support for timeouts. Similarly to the TCP sockets, all methods are marked #[experimental] due to uncertainty about the type of the timeout argument. This internally involved a good bit of refactoring to share as much code as possible between TCP servers and pipe servers, but the core implementation did not change drastically as part of this commit. cc #13523
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/rtio.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 5dd14834669..f3c7fdaf710 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -152,7 +152,8 @@ pub trait IoFactory { fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send>; fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener:Send>; - fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe:Send>; + fn unix_connect(&mut self, path: &CString, + timeout: Option<u64>) -> IoResult<~RtioPipe:Send>; fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, hint: Option<ai::Hint>) -> IoResult<~[ai::Info]>; @@ -274,6 +275,7 @@ pub trait RtioUnixListener { pub trait RtioUnixAcceptor { fn accept(&mut self) -> IoResult<~RtioPipe:Send>; + fn set_timeout(&mut self, timeout: Option<u64>); } pub trait RtioTTY { |
