desktop: remove Option for connection timeout
This commit is contained in:
parent
ac1badc64f
commit
caddd5512b
|
@ -331,7 +331,7 @@ impl NavigatorBackend for ExternalNavigatorBackend {
|
||||||
&mut self,
|
&mut self,
|
||||||
host: String,
|
host: String,
|
||||||
port: u16,
|
port: u16,
|
||||||
timeout: Option<Duration>,
|
timeout: Duration,
|
||||||
handle: SocketHandle,
|
handle: SocketHandle,
|
||||||
receiver: Receiver<Vec<u8>>,
|
receiver: Receiver<Vec<u8>>,
|
||||||
sender: Sender<SocketAction>,
|
sender: Sender<SocketAction>,
|
||||||
|
@ -375,18 +375,13 @@ impl NavigatorBackend for ExternalNavigatorBackend {
|
||||||
|
|
||||||
let mut pending_write = vec![];
|
let mut pending_write = vec![];
|
||||||
|
|
||||||
let stream = if let Some(timeout) = timeout {
|
let mut stream = match TcpStream::connect((host, port))
|
||||||
TcpStream::connect((host, port))
|
|
||||||
.or(async {
|
.or(async {
|
||||||
Timer::after(timeout).await;
|
Timer::after(timeout).await;
|
||||||
Result::<TcpStream, io::Error>::Err(io::Error::new(ErrorKind::TimedOut, ""))
|
Result::<TcpStream, io::Error>::Err(io::Error::new(ErrorKind::TimedOut, ""))
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
} else {
|
{
|
||||||
TcpStream::connect((host, port)).await
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut stream = match stream {
|
|
||||||
Ok(stream) => {
|
Ok(stream) => {
|
||||||
sender
|
sender
|
||||||
.send(SocketAction::Connect(handle, true))
|
.send(SocketAction::Connect(handle, true))
|
||||||
|
|
Loading…
Reference in New Issue