Fix tests on windows
This commit is contained in:
parent
143556078b
commit
140ef1b988
|
|
@ -169,12 +169,13 @@ impl Write for UdpConnected {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||||
use std::os::windows::prelude::*;
|
use std::os::windows::prelude::*;
|
||||||
use libc;
|
use ws2_32;
|
||||||
|
|
||||||
let n = unsafe {
|
let n = unsafe {
|
||||||
libc::send(self.0.as_raw_socket(),
|
ws2_32::send(self.0.as_raw_socket(),
|
||||||
buf.as_ptr() as *const _,
|
buf.as_ptr() as *const _,
|
||||||
buf.len() as libc::c_int,
|
buf.len() as libc::c_int,
|
||||||
0)
|
0)
|
||||||
};
|
};
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
Err(io::Error::last_os_error())
|
Err(io::Error::last_os_error())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue