@@ -43,7 +43,7 @@ use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
4343use sys:: net:: netc:: IPV6_DROP_MEMBERSHIP ;
4444
4545#[ cfg( target_os = "linux" ) ]
46- const MSG_NOSIGNAL : c_int = 0x4000 ;
46+ use libc :: MSG_NOSIGNAL ;
4747#[ cfg( not( target_os = "linux" ) ) ]
4848const MSG_NOSIGNAL : c_int = 0x0 ; // unused dummy value
4949
@@ -226,12 +226,11 @@ impl TcpStream {
226226
227227 pub fn write ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
228228 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 } ;
230229 let ret = cvt ( unsafe {
231230 c:: send ( * self . inner . as_inner ( ) ,
232231 buf. as_ptr ( ) as * const c_void ,
233232 len,
234- flags )
233+ MSG_NOSIGNAL )
235234 } ) ?;
236235 Ok ( ret as usize )
237236 }
@@ -452,11 +451,10 @@ impl UdpSocket {
452451 pub fn send_to ( & self , buf : & [ u8 ] , dst : & SocketAddr ) -> io:: Result < usize > {
453452 let len = cmp:: min ( buf. len ( ) , <wrlen_t >:: max_value ( ) as usize ) as wrlen_t ;
454453 let ( dstp, dstlen) = dst. into_inner ( ) ;
455- let flags = if cfg ! ( target_os = "linux" ) { MSG_NOSIGNAL } else { 0 } ;
456454 let ret = cvt ( unsafe {
457455 c:: sendto ( * self . inner . as_inner ( ) ,
458456 buf. as_ptr ( ) as * const c_void , len,
459- flags , dstp, dstlen)
457+ MSG_NOSIGNAL , dstp, dstlen)
460458 } ) ?;
461459 Ok ( ret as usize )
462460 }
@@ -576,12 +574,11 @@ impl UdpSocket {
576574
577575 pub fn send ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
578576 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 } ;
580577 let ret = cvt ( unsafe {
581578 c:: send ( * self . inner . as_inner ( ) ,
582579 buf. as_ptr ( ) as * const c_void ,
583580 len,
584- flags )
581+ MSG_NOSIGNAL )
585582 } ) ?;
586583 Ok ( ret as usize )
587584 }
0 commit comments