mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
Fix UDP test
This commit is contained in:
parent
1c88b8f336
commit
335c3e73a4
@ -40,12 +40,12 @@ fn send_messages<S: SendFn + Clone, R: RecvFn + Clone>(send: S, recv: R) {
|
||||
|
||||
#[test]
|
||||
fn send_to_and_recv_from() {
|
||||
send_messages(SendTo {}, RecvFrom {});
|
||||
send_messages(SendTo {}, RecvFrom {});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn send_and_recv() {
|
||||
send_messages(Send {}, Recv {});
|
||||
send_messages(Send {}, Recv {});
|
||||
}
|
||||
|
||||
trait SendFn {
|
||||
@ -66,7 +66,7 @@ struct Send {}
|
||||
|
||||
impl SendFn for Send {
|
||||
fn send(&self, socket: &UdpSocket, buf: &[u8], addr: &SocketAddr) -> Result<usize, io::Error> {
|
||||
socket.connect(*addr).expect("could not connect");
|
||||
socket.connect(addr).expect("could not connect");
|
||||
socket.send(buf)
|
||||
}
|
||||
}
|
||||
@ -83,7 +83,7 @@ impl<S: SendFn> SendMessage<S> {
|
||||
SendMessage {
|
||||
socket: Some(socket),
|
||||
send: send,
|
||||
addr: addr,
|
||||
addr: addr,
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user