summary refs log tree commit diff
path: root/src/libstd/io/net
AgeCommit message (Collapse)AuthorLines
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-2/+3
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-4/+4
Closes #2569
2014-03-27Fix fallout of removing default boundsAlex Crichton-13/+16
This is all purely fallout of getting the previous commit to compile.
2014-03-25std: Touch various I/O documentation blocksAlex Crichton-2/+30
These are mostly touchups from the previous commit.
2014-03-25libstd: Document the following modules:Patrick Walton-9/+52
* native::io * std::char * std::fmt * std::fmt::parse * std::io * std::io::extensions * std::io::net::ip * std::io::net::udp * std::io::net::unix * std::io::pipe * std::num * std::num::f32 * std::num::f64 * std::num::strconv * std::os
2014-03-20rename std::vec -> std::sliceDaniel Micay-2/+2
Closes #12702
2014-03-13auto merge of #12855 : alexcrichton/rust/shutdown, r=brsonbors-0/+18
This is something that is plausibly useful, and is provided by libuv. This is not currently surfaced as part of the `TcpStream` type, but it may possibly appear in the future. For now only the raw functionality is provided through the Rtio objects.
2014-03-13io: Bind to shutdown() for TCP streamsAlex Crichton-0/+18
This is something that is plausibly useful, and is provided by libuv. This is not currently surfaced as part of the `TcpStream` type, but it may possibly appear in the future. For now only the raw functionality is provided through the Rtio objects.
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-159/+116
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-03-04Rename struct fields with uppercase characters in their names to use lowercasePalmer Cox-4/+4
2014-03-04Rename all variables that have uppercase characters in their names to use ↵Palmer Cox-2/+2
only lowercase characters
2014-02-28std: Improve some I/O documentationAlex Crichton-0/+10
This lowers the #[allow(missing_doc)] directive into some of the lower modules which are less mature. Most I/O modules now require comprehensive documentation.
2014-02-27std: Small cleanup and test improvementAlex Crichton-6/+10
This weeds out a bunch of warnings building stdtest on windows, and it also adds a check! macro to the io::fs tests to help diagnose errors that are cropping up on windows platforms as well. cc #12516
2014-02-25auto merge of #12522 : erickt/rust/hash, r=alexcrichtonbors-1/+0
This patch series does a couple things: * replaces manual `Hash` implementations with `#[deriving(Hash)]` * adds `Hash` back to `std::prelude` * minor cleanup of whitespace and variable names.
2014-02-24Remove std::from_str::FromStr from the preludeBrendan Zabarauskas-0/+1
2014-02-24std: minor whitespace cleanupErick Tryzelaar-1/+0
2014-02-24Correctly ignore some tests on windowsAlex Crichton-1/+1
These two tests are notoriously flaky on the windows bots right now, so I'm ignoring them until I can investigate them some more. The truncate_works test has been flaky for quite some time, but it has gotten much worse recently. The test_exists test has been flaky since the recent std::run rewrite landed. Finally, the "unix pipe" test failure is a recent discovery on the try bots. I haven't seen this failing much, but better safe than sorry! cc #12516
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-13/+14
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-14/+2
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.