diff options
| author | bors <bors@rust-lang.org> | 2014-01-06 10:31:46 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-06 10:31:46 -0800 |
| commit | 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2 (patch) | |
| tree | a38543052b4f21492467265630caf5f89e396de6 /src/libnative | |
| parent | 8b71b6415dd16dc694bc7d3b1a99d0116b6a0cee (diff) | |
| parent | 11e568c886ce1ced558dc638065f938ea3dee973 (diff) | |
| download | rust-0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2.tar.gz rust-0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2.zip | |
auto merge of #11334 : alexcrichton/rust/fix-native-tcp, r=pcwalton
libnative erroneously would attempt to fill the entire buffer in a call to `read` before returning, when rather it should return immediately because there's not guaranteed to be any data that will ever be received again. Close #11328
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/net.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index b26ac141192..adcd21f0ac4 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -275,12 +275,12 @@ impl TcpStream { impl rtio::RtioTcpStream for TcpStream { fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { - let ret = keep_going(buf, |buf, len| { + let ret = retry(|| { unsafe { libc::recv(self.fd, - buf as *mut libc::c_void, - len as wrlen, - 0) as i64 + buf.as_ptr() as *mut libc::c_void, + buf.len() as wrlen, + 0) as libc::c_int } }); if ret == 0 { |
