@@ -43,7 +43,7 @@ use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
43
43
use sys:: net:: netc:: IPV6_DROP_MEMBERSHIP ;
44
44
45
45
#[ cfg( target_os = "linux" ) ]
46
- const MSG_NOSIGNAL : c_int = 0x4000 ;
46
+ use libc :: MSG_NOSIGNAL ;
47
47
#[ cfg( not( target_os = "linux" ) ) ]
48
48
const MSG_NOSIGNAL : c_int = 0x0 ; // unused dummy value
49
49
@@ -226,12 +226,11 @@ impl TcpStream {
226
226
227
227
pub fn write ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
228
228
let len = cmp:: min ( buf. len ( ) , <wrlen_t >:: max_value ( ) as usize ) as wrlen_t ;
229
- let flags = if cfg ! ( target_os = "linux" ) { MSG_NOSIGNAL } else { 0 } ;
230
229
let ret = cvt ( unsafe {
231
230
c:: send ( * self . inner . as_inner ( ) ,
232
231
buf. as_ptr ( ) as * const c_void ,
233
232
len,
234
- flags )
233
+ MSG_NOSIGNAL )
235
234
} ) ?;
236
235
Ok ( ret as usize )
237
236
}
@@ -452,11 +451,10 @@ impl UdpSocket {
452
451
pub fn send_to ( & self , buf : & [ u8 ] , dst : & SocketAddr ) -> io:: Result < usize > {
453
452
let len = cmp:: min ( buf. len ( ) , <wrlen_t >:: max_value ( ) as usize ) as wrlen_t ;
454
453
let ( dstp, dstlen) = dst. into_inner ( ) ;
455
- let flags = if cfg ! ( target_os = "linux" ) { MSG_NOSIGNAL } else { 0 } ;
456
454
let ret = cvt ( unsafe {
457
455
c:: sendto ( * self . inner . as_inner ( ) ,
458
456
buf. as_ptr ( ) as * const c_void , len,
459
- flags , dstp, dstlen)
457
+ MSG_NOSIGNAL , dstp, dstlen)
460
458
} ) ?;
461
459
Ok ( ret as usize )
462
460
}
@@ -576,12 +574,11 @@ impl UdpSocket {
576
574
577
575
pub fn send ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
578
576
let len = cmp:: min ( buf. len ( ) , <wrlen_t >:: max_value ( ) as usize ) as wrlen_t ;
579
- let flags = if cfg ! ( target_os = "linux" ) { MSG_NOSIGNAL } else { 0 } ;
580
577
let ret = cvt ( unsafe {
581
578
c:: send ( * self . inner . as_inner ( ) ,
582
579
buf. as_ptr ( ) as * const c_void ,
583
580
len,
584
- flags )
581
+ MSG_NOSIGNAL )
585
582
} ) ?;
586
583
Ok ( ret as usize )
587
584
}
0 commit comments