summary refs log tree commit diff
path: root/src/libnative/io/net.rs
AgeCommit message (Collapse)AuthorLines
2014-03-27Fix fallout of removing default boundsAlex Crichton-8/+8
This is all purely fallout of getting the previous commit to compile.
2014-03-13io: Bind to shutdown() for TCP streamsAlex Crichton-0/+5
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-02-27native: Improve windows file handlingAlex Crichton-12/+7
This commit splits the file implementation into file_unix and file_win32. The two implementations have diverged to the point that they share almost 0 code at this point, so it's easier to maintain as separate files. The other major change accompanied with this commit is that file::open is no longer based on libc's open function on windows, but rather windows's CreateFile function. This fixes dealing with binary files on windows (test added in previous commit). This also changes the read/write functions to use ReadFile and WriteFile instead of libc's read/write. Closes #12406
2014-02-24native: be more const correct with the FFI calls.Huon Wilson-1/+1
These calls are mutating their argument and so it's bad behaviour to be pretending that the values are immutable to rustc.
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-1/+3
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-02-16std: Rename unstable::mutex::Mutex to StaticNativeMutex.Huon Wilson-2/+2
This better reflects its purpose and design.
2014-02-16std: add an RAII unlocker to Mutex.Huon Wilson-2/+1
This automatically unlocks its lock when it goes out of scope, and provides a safe(ish) method to call .wait.
2014-02-09std: Move byteswap functions to memBrian Anderson-3/+2
2014-02-09std: Add init and uninit to mem. Replace direct intrinsic usageBrian Anderson-5/+5
2014-02-05Implement clone() for TCP/UDP/Unix socketsAlex Crichton-48/+82
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-03Various bug fixes and rebase conflictsAlex Crichton-10/+9
2014-02-03extra: Re-add the Once primitve to extra::syncAlex Crichton-8/+14
This originally lived in std::unstable::mutex, but now it has a new home (and a more proper one).
2014-02-03native: Require all results are used and fix falloutAlex Crichton-2/+2
2014-01-27Set SO_REUSEADDR by default in libnative.xales-0/+11
Fixes std::net test error when re-running too quickly.
2014-01-22libnative: Implement get_host_addresses.Luqman Aden-2/+2
2014-01-06Don't wait for a full buffer when reading TCPAlex Crichton-4/+4
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-05Handle EINTR throughout libnativeAlex Crichton-18/+26
Closes #11214
2014-01-01libnative: Use [from|to]_be16 instead of bswap16Carl-Anton Ingmarsson-6/+2
2013-12-31auto merge of #11187 : alexcrichton/rust/once, r=brsonbors-9/+4
Rationale can be found in the first commit, but this is basically the same thing as `pthread_once`
2013-12-31Convert relevant static mutexes to OnceAlex Crichton-9/+4
2013-12-31Implement native UDP I/OAlex Crichton-87/+262
2013-12-27Implement native TCP I/OAlex Crichton-0/+412