about summary refs log tree commit diff
path: root/src/libnative/io/net.rs
AgeCommit message (Collapse)AuthorLines
2014-11-08Runtime removal: refactor pipes and networkingAaron Turon-1103/+0
This patch continues the runtime removal by moving pipe and networking-related code into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-10-10Register new snapshotsAlex Crichton-1/+1
Also convert a number of `static mut` to just a plain old `static` and remove some unsafe blocks.
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-1/+1
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-1/+1
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-1/+1
2014-09-30Fix libnativeSteven Fackler-6/+6
2014-09-24liblibc and libnative: send() should use const buffers.NODA, Kai-1/+1
2014-09-19Add enum variants to the type namespaceNick Cameron-4/+4
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-16Fallout from renamingAaron Turon-2/+2
2014-09-09rollup merge of #17020 : nodakai/libnative-c_intAlex Crichton-6/+3
2014-09-08libnative/io: generic retry() for Unix 64 bit read/write().NODA, Kai-6/+3
Win32/WinSock APIs never call WSASetLastError() with WSAEINTR unless a programmer specifically cancels the ongoing blocking call by a deprecated WinSock1 API WSACancelBlockingCall(). So the errno check was simply removed and retry() became an id function on Windows. Note: Windows' equivalent of SIGINT is always handled in a separate thread: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx "CTRL+C and CTRL+BREAK Signals" Also, incidentally rename a type parameter and clean up some module imports.
2014-09-07auto merge of #16942 : alexcrichton/rust/remove-net-assert, r=brsonbors-1/+1
This assert was likely inherited from some point, but it's not quite valid as a no-timeout read may enter this loop, but data could be stolen by any other read after the socket is deemed readable. I saw this fail in a recent bors run where the assertion was tripped.
2014-09-03Fix spelling errors and capitalization.Joseph Crail-3/+3
2014-09-02native: Remove a bogus assert in net::readAlex Crichton-1/+1
This assert was likely inherited from some point, but it's not quite valid as a no-timeout read may enter this loop, but data could be stolen by any other read after the socket is deemed readable. I saw this fail in a recent bors run where the assertion was tripped.
2014-08-24native: clone/close_accept for win32 pipesAlex Crichton-12/+23
This commits takes a similar strategy to the previous commit to implement close_accept and clone for the native win32 pipes implementation. Closes #15595
2014-08-24native: Add some documentation for acceptAlex Crichton-0/+34
Document the new code for how close_accept and timeouts are implemented.
2014-08-24native: TCP close/close_accept for windowsAlex Crichton-74/+181
This commit implements TcpAcceptor::{close, close_accept} for windows via WSAEVENT types.
2014-08-24native: Implement clone/close_accept for unixAlex Crichton-20/+73
This commits implements {Tcp,Unix}Acceptor::{clone,close_accept} methods for unix. A windows implementation is coming in a later commit. The clone implementation is based on atomic reference counting (as with all other clones), and the close_accept implementation is based on selecting on a self-pipe which signals that a close has been seen.
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-2/+2
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-04Change everything returning `libc::sockaddr_storage` to use an &mut out-ptr ↵Andrew Poelstra-17/+18
instead The BSD socket code does some cast tricks with the `libc::sockaddr*` structs, which causes useful data to be stored in struct padding. Since Load/Store instructions do not copy struct padding, this makes these structures dangerous to pass or return by value. In particular, https://github.com/rust-lang/rust/issues/15763 changes return semantics so that a Load instruction is used, breaking the TCP code. Once this PR is merged, that one should merge without error.
2014-08-01Fix misspelled comments.Joseph Crail-1/+1
2014-07-29Port Rust to DragonFlyBSDMichael Neumann-1/+3
Not included are two required patches: * LLVM: segmented stack support for DragonFly [1] * jemalloc: simple configure patches [1]: http://reviews.llvm.org/D4705
2014-07-24libsyntax: Remove `~self` and `mut ~self` from the language.Patrick Walton-1/+2
This eliminates the last vestige of the `~` syntax. Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut ~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with the self-type parameter as specified in the implementation. Closes #13885. [breaking-change]
2014-07-03Fix spelling errors.Joseph Crail-1/+1
2014-07-02Rename recvfrom -> recv_from, sendto -> send_to.OGINO Masanori-2/+2
POSIX has recvfrom(2) and sendto(2), but their name seem not to be suitable with Rust. We already renamed getpeername(2) and getsockname(2), so I think it makes sense. Alternatively, `receive_from` would be fine. However, we have `.recv()` so I chose `recv_from`. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-28Rename all raw pointers as necessaryAlex Crichton-9/+9
2014-06-18Shorten endian conversion method namesBrendan Zabarauskas-4/+4
The consensus on #14917 was that the proposed names were too long.
2014-06-18Merge the Bitwise and ByteOrder traits into the Int traitBrendan Zabarauskas-3/+2
This reduces the complexity of the trait hierarchy.
2014-06-18Use ByteOrder methods instead of free-standing functionsBrendan Zabarauskas-4/+5
2014-06-16auto merge of #14900 : alexcrichton/rust/snapshots, r=huonwbors-8/+8
Closes #14898 Closes #14918
2014-06-16auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichtonbors-1/+2
2014-06-15Register new snapshotsAlex Crichton-8/+8
2014-06-13Fix all violations of stronger guarantees for mutable borrowsCameron Zwarich-3/+2
Fix all violations in the Rust source tree of the stronger guarantee of a unique access path for mutable borrows as described in #12624.
2014-06-12Basic iOS supportValerii Hiora-1/+2
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-1/+4
2014-06-06libs: Fix miscellaneous fallout of librustrtAlex Crichton-2/+4
2014-06-06native: Deal with the rtio changesAlex Crichton-50/+51
2014-05-28fix MIPS targetJyun-Yan You-9/+10
2014-05-21auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brsonbors-15/+9
This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.
2014-05-21std,green: Mark some queue types as NoShareAlex Crichton-2/+2
2014-05-20core: Stabilize the mem moduleAlex Crichton-6/+6
Excluding the functions inherited from the cast module last week (with marked stability levels), these functions received the following treatment. * size_of - this method has become #[stable] * nonzero_size_of/nonzero_size_of_val - these methods have been removed * min_align_of - this method is now #[stable] * pref_align_of - this method has been renamed without the `pref_` prefix, and it is the "default alignment" now. This decision is in line with what clang does (see url linked in comment on function). This function is now #[stable]. * init - renamed to zeroed and marked #[stable] * uninit - marked #[stable] * move_val_init - renamed to overwrite and marked #[stable] * {from,to}_{be,le}{16,32,64} - all functions marked #[stable] * swap/replace/drop - marked #[stable] * size_of_val/min_align_of_val/align_of_val - these functions are marked #[unstable], but will continue to exist in some form. Concerns have been raised about their `_val` prefix. [breaking-change]
2014-05-19native: Remove UnsafeArc in favor of just ArcAlex Crichton-13/+7
2014-05-11core: Remove the cast moduleAlex Crichton-5/+4
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-09Register new snapshotsAlex Crichton-1/+1
2014-05-07native: Implement timeouts for windows pipesAlex Crichton-2/+0
This is the last remaining networkig object to implement timeouts for. This takes advantage of the CancelIo function and the already existing asynchronous I/O functionality of pipes.
2014-05-07native: Implement timeouts for unix networkingAlex Crichton-104/+353
This commit has an implementation of the previous commit's timeout interface for I/O objects on unix platforms. For implementation details, see the large comment at the end of libnative/io/net.rs which talks about the general strategy taken. Thankfully, all of these implementations can share code because they're performing all the same operations. This commit does not implement timeouts for named pipes on windows, only tcp/udp objects on windows (which are quite similar to their unix equivalents).
2014-05-07std: Add close_{read,write}() methods to I/OAlex Crichton-3/+4
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-8/+14
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-4/+4
2014-04-24std: Add timeouts to unix connect/acceptAlex Crichton-122/+6
This adds support for connecting to a unix socket with a timeout (a named pipe on windows), and accepting a connection with a timeout. The goal is to bring unix pipes/named sockets back in line with TCP support for timeouts. Similarly to the TCP sockets, all methods are marked #[experimental] due to uncertainty about the type of the timeout argument. This internally involved a good bit of refactoring to share as much code as possible between TCP servers and pipe servers, but the core implementation did not change drastically as part of this commit. cc #13523