diff options
| author | bors <bors@rust-lang.org> | 2016-10-01 01:19:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-01 01:19:47 -0700 |
| commit | 5045d4e39621b265eca947277f07e23f62608ad0 (patch) | |
| tree | ce679fbf026bd14ac8c54f9b82093a4454cf0909 /src/libstd/sys/common | |
| parent | 8b00355119ba0473eae420049f96f5be91be1bab (diff) | |
| parent | 5980d5bfddb8f1e92cee7f9a156c4758615bee4b (diff) | |
| download | rust-5045d4e39621b265eca947277f07e23f62608ad0.tar.gz rust-5045d4e39621b265eca947277f07e23f62608ad0.zip | |
Auto merge of #36824 - kali:master, r=alexcrichton
SO_NOSIGPIPE and MSG_NOSIGNAL (rebased #36426) I'm not sure what happened when I pushed a rebased branch on #36426 , github closed it...
Diffstat (limited to 'src/libstd/sys/common')
| -rw-r--r-- | src/libstd/sys/common/net.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 18280e497db..2599bb660e8 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -42,6 +42,11 @@ use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; target_os = "solaris", target_os = "haiku")))] use sys::net::netc::IPV6_DROP_MEMBERSHIP; +#[cfg(target_os = "linux")] +use libc::MSG_NOSIGNAL; +#[cfg(not(target_os = "linux"))] +const MSG_NOSIGNAL: c_int = 0x0; // unused dummy value + //////////////////////////////////////////////////////////////////////////////// // sockaddr and misc bindings //////////////////////////////////////////////////////////////////////////////// @@ -225,7 +230,7 @@ impl TcpStream { c::send(*self.inner.as_inner(), buf.as_ptr() as *const c_void, len, - 0) + MSG_NOSIGNAL) })?; Ok(ret as usize) } @@ -449,7 +454,7 @@ impl UdpSocket { let ret = cvt(unsafe { c::sendto(*self.inner.as_inner(), buf.as_ptr() as *const c_void, len, - 0, dstp, dstlen) + MSG_NOSIGNAL, dstp, dstlen) })?; Ok(ret as usize) } @@ -573,7 +578,7 @@ impl UdpSocket { c::send(*self.inner.as_inner(), buf.as_ptr() as *const c_void, len, - 0) + MSG_NOSIGNAL) })?; Ok(ret as usize) } |
