pull/146/head
Chip Senkbeil 2 years ago
parent 0aad5f8cab
commit fcdf589e3f
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -101,7 +101,7 @@ mod tests {
.map_err(|x| io::Error::new(io::ErrorKind::Other, x))?;
// Get first connection
let mut conn_1 = listener.accept().await?;
let conn_1 = listener.accept().await?;
// Send some data to the first connection (12 bytes)
conn_1.write_all(b"hello conn 1").await?;
@ -112,7 +112,7 @@ mod tests {
assert_eq!(&buf, b"hello server 1");
// Get second connection
let mut conn_2 = listener.accept().await?;
let conn_2 = listener.accept().await?;
// Send some data on to second connection (12 bytes)
conn_2.write_all(b"hello conn 2").await?;
@ -131,7 +131,7 @@ mod tests {
// Connect to the listener twice, sending some bytes and receiving some bytes from each
let mut buf: [u8; 12] = [0; 12];
let mut conn = WindowsPipeTransport::connect_local(&name)
let conn = WindowsPipeTransport::connect_local(&name)
.await
.expect("Conn 1 failed to connect");
conn.write_all(b"hello server 1")
@ -142,7 +142,7 @@ mod tests {
.expect("Conn 1 failed to read");
assert_eq!(&buf, b"hello conn 1");
let mut conn = WindowsPipeTransport::connect_local(&name)
let conn = WindowsPipeTransport::connect_local(&name)
.await
.expect("Conn 2 failed to connect");
conn.write_all(b"hello server 2")

@ -64,21 +64,21 @@ impl Reconnectable for WindowsPipeTransport {
#[async_trait]
impl RawTransport for WindowsPipeTransport {
fn try_read(&self, buf: &mut [u8]) -> io::Result<usize> {
match self.inner {
match &self.inner {
NamedPipe::Client(x) => x.try_read(buf),
NamedPipe::Server(x) => x.try_read(buf),
}
}
fn try_write(&self, buf: &[u8]) -> io::Result<usize> {
match self.inner {
match &self.inner {
NamedPipe::Client(x) => x.try_write(buf),
NamedPipe::Server(x) => x.try_write(buf),
}
}
async fn ready(&self, interest: Interest) -> io::Result<Ready> {
match self.inner {
match &self.inner {
NamedPipe::Client(x) => x.ready(interest).await,
NamedPipe::Server(x) => x.ready(interest).await,
}
@ -145,7 +145,7 @@ mod tests {
// Connect to the pipe, send some bytes, and get some bytes
let mut buf: [u8; 10] = [0; 10];
let mut conn = WindowsPipeTransport::connect(&address)
let conn = WindowsPipeTransport::connect(&address)
.await
.expect("Conn failed to connect");
conn.read_exact(&mut buf)

Loading…
Cancel
Save