From 3915e17cd70e2d584726364851d368badb8bf15b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 18 Apr 2014 13:23:56 -0700 Subject: std: Add an experimental connect_timeout function This adds a `TcpStream::connect_timeout` function in order to assist opening connections with a timeout (cc #13523). There isn't really much design space for this specific operation (unlike timing out normal blocking reads/writes), so I am fairly confident that this is the correct interface for this function. The function is marked #[experimental] because it takes a u64 timeout argument, and the u64 type is likely to change in the future. --- src/libstd/rt/rtio.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index cc8356d2b9a..0f3fc9c21ce 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -146,7 +146,8 @@ impl<'a> LocalIo<'a> { pub trait IoFactory { // networking - fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream:Send>; + fn tcp_connect(&mut self, addr: SocketAddr, + timeout: Option) -> IoResult<~RtioTcpStream:Send>; fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send>; fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send>; fn unix_bind(&mut self, path: &CString) -- cgit 1.4.1-3-g733a5