Add timeout when waiting for named pipe.

This commit is contained in:
Nick 2018-08-28 09:36:46 -07:00
parent 1147824a0f
commit 80d9794c09
No known key found for this signature in database
GPG Key ID: ACB10FF5A19815BF
2 changed files with 3 additions and 2 deletions

View File

@ -10,7 +10,7 @@ futures = "0.1"
tokio = "0.1"
rand = "0.3"
mio-named-pipes = { git = "https://github.com/alexcrichton/mio-named-pipes" }
miow = "0.3.2"
miow = "~0.3.2"
log = "*"
bytes = "0.4"

View File

@ -251,7 +251,8 @@ impl IpcConnection {
use std::os::windows::io::{FromRawHandle, IntoRawHandle};
use winapi::um::winbase::FILE_FLAG_OVERLAPPED;
miow::pipe::NamedPipe::wait(path, None)?;
// Wait for the pipe to become available and fail after 3 seconds.
miow::pipe::NamedPipe::wait(path, Some(std::time::Duration::from_millis(3000)))?;
let mut options = OpenOptions::new();
options.read(true)
.write(true)