about summary refs log tree commit diff
path: root/src/libstd/io/net
AgeCommit message (Collapse)AuthorLines
2014-02-16Implement named pipes for windows, touch up unixAlex Crichton-42/+61
* Implementation of pipe_win32 filled out for libnative * Reorganize pipes to be clone-able * Fix a few file descriptor leaks on error * Factor out some common code into shared functions * Make use of the if_ok!() macro for less indentation Closes #11201
2014-02-14Fix all code examplesAlex Crichton-5/+8
2014-02-11Test fixes and rebase conflictsAlex Crichton-4/+4
2014-02-11io -- introduce local to avoid conflicting borrowNiko Matsakis-1/+2
2014-02-10IterBytes for IpAddr and SocketAddrTom Lee-2/+13
2014-02-05Make a double-write UDP test more robustAlex Crichton-7/+10
I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy protocol, I don't think we can guarantee that the server can receive both packets, so just listen for one of them.
2014-02-05Implement clone() for TCP/UDP/Unix socketsAlex Crichton-1/+393
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: Fixing all documentationAlex Crichton-18/+0
* Stop referencing io_error * Start changing "Failure" sections to "Error" sections * Update all doc examples to work.
2014-02-03std: Fix tests with io_error usageAlex Crichton-185/+144
2014-02-03std: Remove io::io_errorAlex Crichton-139/+59
* 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-7/+3
Moving forward to green waterfall.
2014-01-30Remove Times traitBrendan Zabarauskas-10/+10
`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-30Remove unused imports.OGINO Masanori-4/+0
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-29Removing do keyword from libstd and librustcScott Lawrence-62/+62
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-2/+2
2014-01-24libstd: Use iotest! for for get_host_addresses.Luqman Aden-5/+11
2014-01-13std: Ignore bind error tests on android. #11530Brian Anderson-2/+4
2014-01-09Remove eof() from io::ReaderAlex Crichton-5/+0
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-5/+2
2014-01-07std: Fill in all missing importsAlex Crichton-1/+3
Fallout from the previous commits
2014-01-07auto merge of #11329 : fhahn/rust/unused-cast-lint2, r=alexcrichtonbors-3/+3
Updates as mentioned in #11135
2014-01-06Remove some unnecessary type castsFlorian Hahn-3/+3
Conflicts: src/librustc/middle/lint.rs
2014-01-06auto merge of #11334 : alexcrichton/rust/fix-native-tcp, r=pcwaltonbors-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
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
2014-01-05Fix some warningsCorey Richardson-2/+1
2013-12-31Implement native UDP I/OAlex Crichton-23/+25
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-25Test fixes and rebase conflictsAlex Crichton-1/+2
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24std: Get stdtest all passing againAlex Crichton-42/+36
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-53/+16
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-515/+453
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-17auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichtonbors-1/+1
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17Handle ENOENTCadence Marseille-1/+1
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-16Test fallout from std::comm rewriteAlex Crichton-2/+2
2013-12-16Fallout of rewriting std::commAlex Crichton-135/+98
2013-12-11Make 'self lifetime illegal.Erik Price-4/+4
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-10librustuv: Change `with_local_io` to use RAII.Patrick Walton-55/+52
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-93/+45
34 uses of `Cell` remain.
2013-11-28Register new snapshotsAlex Crichton-2/+2
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-6/+6
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-38/+38
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-45/+31
2013-11-25std: IPv6 addresses are represented as eight groups of four HEXADECIMAL digitsAndreas Ots-1/+2
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-10/+17
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-1/+1
This makes `Cell`s no longer necessary in most cases.
2013-11-11Move std::rt::io to std::ioAlex Crichton-0/+1936