File tree 3 files changed +9
-6
lines changed
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
use dgram:: RecvData ;
2
2
3
+ #[ cfg( target_os = "linux" ) ]
3
4
use std:: io;
4
5
5
6
/// For Linux, try to detect if GRO is available. If it is, the
@@ -28,7 +29,7 @@ pub fn detect_gro(socket: &mio::net::UdpSocket) -> bool {
28
29
}
29
30
30
31
#[ cfg( not( target_os = "linux" ) ) ]
31
- pub fn detect_gro ( socket : & mio:: net:: UdpSocket , _segment_size : usize ) -> bool {
32
+ pub fn detect_gro ( _socket : & mio:: net:: UdpSocket ) -> bool {
32
33
false
33
34
}
34
35
@@ -52,7 +53,7 @@ pub fn recv_from(
52
53
}
53
54
54
55
#[ cfg( not( target_os = "linux" ) ) ]
55
- fn recv_from (
56
+ pub fn recv_from (
56
57
socket : & mio:: net:: UdpSocket , buf : & mut [ u8 ] ,
57
58
) -> std:: io:: Result < RecvData > {
58
59
match socket. recv_from ( buf) {
Original file line number Diff line number Diff line change 1
1
pub mod socket_setup;
2
+ #[ cfg( target_os = "linux" ) ]
2
3
pub mod sync;
3
4
mod syscalls;
4
5
#[ cfg( feature = "async" ) ]
5
6
pub mod tokio;
6
7
7
8
use std:: net:: SocketAddr ;
9
+ #[ cfg( target_os = "linux" ) ]
8
10
use std:: time:: Instant ;
9
11
use std:: time:: SystemTime ;
10
12
@@ -13,7 +15,6 @@ use libc::in_pktinfo;
13
15
use libc:: sockaddr_in;
14
16
use libc:: sockaddr_in6;
15
17
use nix:: sys:: socket:: ControlMessageOwned ;
16
- use nix:: sys:: socket:: MsgFlags ;
17
18
18
19
/// Settings for handling control messages when sending data.
19
20
#[ cfg( target_os = "linux" ) ]
@@ -45,6 +46,7 @@ pub struct RecvMsgSettings<'c> {
45
46
pub cmsg_space : & ' c mut Vec < u8 > ,
46
47
}
47
48
49
+ #[ cfg( target_os = "linux" ) ]
48
50
impl < ' c > RecvMsgSettings < ' c > {
49
51
// Convenience to avoid forcing a specific version of nix
50
52
pub fn new ( store_cmsgs : bool , cmsg_space : & ' c mut Vec < u8 > ) -> Self {
Original file line number Diff line number Diff line change 1
- use std:: time:: SystemTime ;
2
-
3
1
#[ cfg( target_os = "linux" ) ]
4
2
mod linux {
5
3
pub ( super ) use super :: super :: linux_imports:: * ;
6
4
pub ( super ) use std:: os:: fd:: AsFd ;
7
5
pub ( super ) use std:: time:: Instant ;
6
+ pub ( super ) use std:: time:: SystemTime ;
8
7
9
8
pub ( crate ) type SyscallResult < T > = std:: result:: Result < T , Errno > ;
10
9
@@ -17,6 +16,7 @@ mod linux {
17
16
#[ cfg( target_os = "linux" ) ]
18
17
use linux:: * ;
19
18
19
+ #[ cfg( target_os = "linux" ) ]
20
20
fn raw_send_to (
21
21
fd : & impl AsFd , send_buf : & [ u8 ] , cmsgs : & [ ControlMessage ] ,
22
22
msg_flags : MsgFlags , client_addr : Option < SockaddrStorage > ,
@@ -27,7 +27,7 @@ fn raw_send_to(
27
27
sendmsg (
28
28
borrowed. as_raw_fd ( ) ,
29
29
& iov,
30
- & cmsgs,
30
+ cmsgs,
31
31
msg_flags,
32
32
client_addr. as_ref ( ) ,
33
33
)
You can’t perform that action at this time.
0 commit comments