mirror of
https://github.com/Tribufu/rust-gamedig
synced 2026-08-18 11:21:05 +00:00
feat: Add connect timeout to TimeoutSettings (#158)
Because TcpSocket connects in Socket::new TimeoutSettings are now required for Socket::new. Since we already have TimeoutSettings there Sockets are now expected to apply timeout settings in Socket::new.
This commit is contained in:
parent
7416d54b14
commit
e3bdbc2a41
17 changed files with 97 additions and 42 deletions
|
|
@ -25,8 +25,7 @@ fn get_data<Client: QuakeClient>(
|
|||
address: &SocketAddr,
|
||||
timeout_settings: &Option<TimeoutSettings>,
|
||||
) -> GDResult<Vec<u8>> {
|
||||
let mut socket = UdpSocket::new(address)?;
|
||||
socket.apply_timeout(timeout_settings)?;
|
||||
let mut socket = UdpSocket::new(address, timeout_settings)?;
|
||||
retry_on_timeout(
|
||||
TimeoutSettings::get_retries_or_default(timeout_settings),
|
||||
move || get_data_impl::<Client>(&mut socket),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue