about summary refs log tree commit diff
path: root/src/libstd/io/net/tcp.rs
AgeCommit message (Collapse)AuthorLines
2014-02-11Test fixes and rebase conflictsAlex Crichton-1/+1
2014-02-05Implement clone() for TCP/UDP/Unix socketsAlex Crichton-1/+180
This is part of the overall strategy I would like to take when approaching issue #11165. The only two I/O objects that reasonably want to be "split" are the network stream objects. Everything else can be "split" by just creating another version. The initial idea I had was the literally split the object into a reader and a writer half, but that would just introduce lots of clutter with extra interfaces that were a little unnnecssary, or it would return a ~Reader and a ~Writer which means you couldn't access things like the remote peer name or local socket name. The solution I found to be nicer was to just clone the stream itself. The clone is just a clone of the handle, nothing fancy going on at the kernel level. Conceptually I found this very easy to wrap my head around (everything else supports clone()), and it solved the "split" problem at the same time. The cloning support is pretty specific per platform/lib combination: * native/win32 - uses some specific WSA apis to clone the SOCKET handle * native/unix - uses dup() to get another file descriptor * green/all - This is where things get interesting. When we support full clones of a handle, this implies that we're allowing simultaneous writes and reads to happen. It turns out that libuv doesn't support two simultaneous reads or writes of the same object. It does support *one* read and *one* write at the same time, however. Some extra infrastructure was added to just block concurrent writers/readers until the previous read/write operation was completed. I've added tests to the tcp/unix modules to make sure that this functionality is supported everywhere.
2014-02-03Fixing remaining warnings and errors throughoutAlex Crichton-6/+8
2014-02-03std: Fix tests with io_error usageAlex Crichton-110/+84
2014-02-03std: Remove io::io_errorAlex Crichton-67/+15
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
2014-01-31auto merge of #11918 : omasanori/rust/reduce-warnings, r=alexcrichtonbors-3/+3
Moving forward to green waterfall.
2014-01-30Remove Times traitBrendan Zabarauskas-6/+6
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-30Prefix _ to unused variables.OGINO Masanori-3/+3
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-50/+50
2014-01-27Set SO_REUSEADDR by default in libnative.xales-0/+40
Fixes std::net test error when re-running too quickly.
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-1/+1
2014-01-13std: Ignore bind error tests on android. #11530Brian Anderson-1/+2
2014-01-09Remove eof() from io::ReaderAlex Crichton-2/+0
2014-01-06Don't wait for a full buffer when reading TCPAlex Crichton-0/+21
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
2013-12-27Implement native TCP I/OAlex Crichton-65/+40
2013-12-27Bring native process bindings up to dateAlex Crichton-2/+1
Move the tests into libstd, use the `iotest!` macro to test both native and uv bindings, and use the cloexec trick to figure out when the child process fails in exec.
2013-12-24std: Get stdtest all passing againAlex Crichton-35/+27
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24std: Expose that LocalIo may not always be availableAlex Crichton-19/+6
It is not the case that all programs will always be able to acquire an instance of the LocalIo borrow, so this commit exposes this limitation by returning Option<LocalIo> from LocalIo::borrow(). At the same time, a helper method LocalIo::maybe_raise() has been added in order to encapsulate the functionality of raising on io_error if there is on local I/O available.
2013-12-24std: Delete rt::testAlex Crichton-346/+313
This module contains many M:N specific concepts. This will no longer be available with libgreen, and most functions aren't really that necessary today anyway. New testing primitives will be introduced as they become available for 1:1 and M:N. A new io::test module is introduced with the new ip4/ip6 address helpers to continue usage in io tests.
2013-12-16Fallout of rewriting std::commAlex Crichton-82/+59
2013-12-10librustuv: Change `with_local_io` to use RAII.Patrick Walton-18/+19
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-61/+30
34 uses of `Cell` remain.
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-22/+22
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-4/+4
2013-11-11Move std::rt::io to std::ioAlex Crichton-0/+725