about summary refs log tree commit diff
path: root/src/libstd/rt/io/net
AgeCommit message (Collapse)AuthorLines
2013-11-11Move std::rt::io to std::ioAlex Crichton-1935/+0
2013-11-10disable tests on android since tcp/ip permission cannot be acquired without ↵Young-il Choi-0/+1
help of apk
2013-11-03Remove all blocking std::os blocking functionsAlex Crichton-2/+1
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
2013-10-30Make Writer::flush a no-op default methodAlex Crichton-5/+0
Closes #9126
2013-10-29auto merge of #10058 : alexcrichton/rust/uv-crate, r=brsonbors-2/+4
This is one of the final steps needed to complete #9128. It still needs a little bit of polish before closing that issue, but it's in a pretty much "done" state now. The idea here is that the entire event loop implementation using libuv is now housed in `librustuv` as a completely separate library. This library is then injected (via `extern mod rustv`) into executable builds (similarly to how libstd is injected, tunable via `#[no_uv]`) to bring in the "rust blessed event loop implementation." Codegen-wise, there is a new `event_loop_factory` language item which is tagged on a function with 0 arguments returning `~EventLoop`. This function's symbol is then inserted into the crate map for an executable crate, and if there is no definition of the `event_loop_factory` language item then the value is null. What this means is that embedding rust as a library in another language just got a little harder. Libraries don't have crate maps, which means that there's no way to find the event loop implementation to spin up the runtime. That being said, it's always possible to build the runtime manually. This request also makes more runtime components public which should probably be public anyway. This new public-ness should allow custom scheduler setups everywhere regardless of whether you follow the `rt::start `path.
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-2/+4
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
2013-10-28auto merge of #10133 : alexcrichton/rust/another-error, r=thestingerbors-1/+2
This cropped up on the bsd bot, and if it's an error that gets thrown then it's fine to just whitelist another type of error in the test.
2013-10-28Handle another possible error in a unix pipe testAlex Crichton-1/+2
This cropped up on the bsd bot, and if it's an error that gets thrown then it's fine to just whitelist another type of error in the test.
2013-10-26Implement another error code found on windows.Alex Crichton-6/+10
Closes #8811
2013-10-24Test fixes and merge conflictsAlex Crichton-2/+5
2013-10-24Move stdin to using libuv's pipes instead of a ttyAlex Crichton-1/+1
I was seeing a lot of weird behavior with stdin behaving as a tty, and it doesn't really quite make sense, so instead this moves to using libuv's pipes instead (which make more sense for stdin specifically). This prevents piping input to rustc hanging forever.
2013-10-24Remove io::read_errorAlex Crichton-6/+6
The general idea is to remove conditions completely from I/O, so in the meantime remove the read_error condition to mean the same thing as the io_error condition.
2013-10-24Migrate the last typedefs to ~Trait in rtioAlex Crichton-4/+4
There are no longer any remnants of typedefs, and everything is now built on true trait objects.
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-69/+47
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Remove rt::io::supportAlex Crichton-3/+3
This removes the PathLike trait associated with this "support module". This is yet another "container of bytes" trait, so I didn't want to duplicate what already exists throughout libstd. In actuality, we're going to pass of C strings to the libuv APIs, so instead the arguments are now bound with the 'ToCStr' trait instead. Additionally, a layer of complexity was removed by immediately converting these type-generic parameters into CStrings to get handed off to libuv apis.
2013-10-24Migrate Rtio objects to true trait objectsAlex Crichton-15/+11
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-46/+129
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-10-24Implement io::net::unixAlex Crichton-16/+268
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-25/+25
Who doesn't like a massive renaming?
2013-10-16auto merge of #9721 : klutzy/rust/uv-net-read-fix, r=alexcrichtonbors-6/+20
See #9605 for detailed information. This also fixes two tests of #8811.
2013-10-09option: rewrite the API to use compositionDaniel Micay-5/+5
2013-10-05rt::io::net::tcp: Fix eof_twice tests on Win32klutzy-6/+20
cc #8811
2013-10-02Stop using newtype wrappers in std::rt::ioSteven Fackler-20/+28
UnboundedPipeStream is still a newtype since process::set_stdio needs to look into its internals. Closes #9667
2013-09-30std: Remove usage of fmt!Alex Crichton-52/+36
2013-09-26Visibility fixesSteven Fackler-1/+1
2013-09-16std::rt::io::net::tcp: Fix one tcp test on Win32klutzy-2/+7
Fixes `connect_error` part of #8811.
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-1/+1
2013-09-11auto merge of #9114 : sfackler/rust/flush-fix, r=brsonbors-1/+1
2013-09-10Don't fail in TcpStream.flushSteven Fackler-1/+1
2013-09-06Make I/O tests use run_in_mt_newsched_task to get more multi-threaded test ↵Eric Reed-26/+125
coverage
2013-09-06Upgrade libuv to the current master (again)Alex Crichton-1/+1
This is a reopening of the libuv-upgrade part of #8645. Hopefully this won't cause random segfaults all over the place. The windows regression in testing should also be fixed (it shouldn't build the whole compiler twice). A notable difference from before is that gyp is now a git submodule instead of always git-cloned at make time. This allows bundling for releases more easily. Closes #8850
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-2/+43
This is a very simplistic method for host name resolution. It converts a host name to a vector of IP addresses. Should be enough to get started.
2013-09-05std::rt: Add libuv bindings for getaddrinfoBrian Anderson-0/+21
2013-09-04stop treating char as an integer typeDaniel Micay-6/+7
Closes #7609
2013-06-23Split out starting a listener from accepting incoming connections.Eric Reed-51/+63
The Listener trait takes two type parameters, the type of connection and the type of Acceptor, and specifies only one method, listen, which consumes the listener and produces an Acceptor. The Acceptor trait takes one type parameter, the type of connection, and defines two methods. The accept() method waits for an incoming connection attempt and returns the result. The incoming() method creates an iterator over incoming connections and is a default method. Example: let listener = TcpListener.bind(addr); // Bind to a socket let acceptor = listener.listen(); // Start the listener for stream in acceptor.incoming() { // Process incoming connections forever (or until you break out of the loop) }
2013-08-29auto merge of #8819 : vadimcn/rust/unit-tests, r=brsonbors-0/+5
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs... Fixes #5261.
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-4/+4
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-28Turned off libstd unit tests that currently fail on Windows.Vadim Chugunov-0/+5
2013-08-27Implement process bindings to libuvAlex Crichton-3/+3
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-1/+1
There were two main differences with the old libuv and the master version: 1. The uv_last_error function is now gone. The error code returned by each function is the "last error" so now a UvError is just a wrapper around a c_int. 2. The repo no longer includes a makefile, and the build system has change. According to the build directions on joyent/libuv, this now downloads a `gyp` program into the `libuv/build` directory and builds using that. This shouldn't add any dependences on autotools or anything like that. Closes #8407 Closes #6567 Closes #6315
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-20/+40
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-21auto merge of #8600 : sfackler/rust/http, r=brsonbors-29/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.
2013-08-19Do not execute the callback before cleaning up resources.Eric Reed-6/+2
2013-08-19Derive Clone for IpAddr and SocketAddrEric Reed-2/+2
2013-08-18Delete std::rt::io::net::httpSteven Fackler-29/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.
2013-08-09Fix Ipv6Addr to_str for ::1:x.x.x.x addressesStepan Koltsov-1/+8
Reported by luqmana@
2013-08-06Implement FromStr for IpAddr and SocketAddrStepan Koltsov-0/+365
Better than that in rt::uv::net, because it: * handles invalid input explicitly, without fail!() * parses socket address, not just IP * handles various ipv4-in-ipv6 addresses, like 2001:db8:122:344::192.0.2.33 (see http://tools.ietf.org/html/rfc6052 for example) * rejects output like `127.0000000.0.1` * does not allocate heap memory * have unit tests
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-37/+53
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-03remove obsolete `foreach` keywordDaniel Micay-4/+4
this has been replaced by `for`
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-37/+53
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).