Function timeout

Source
async fn timeout<F, R>(fut: F) -> Result<R>
where F: Future<Output = Result<R>>,
Expand description

Helper for performing network I/O under a timeout.

This is meant to be used on network calls performed after a connection to a peer has been successfully established, to avoid the create_sockets protocol becoming stuck because a peer goes away without resetting the connection. We assume fast same-datacenter connections, so we can choose a relatively small timeout.