Go to file
Jeff Olson 6c6a47bf22 std: splitting out tcp server API + tests
- we now have two interfaces for the TCP/IP server/listener workflow,
based on different user approaches surrounding how to deal with the
flow of accept a new tcp connection:

1. the "original" API closely mimics the low-level libuv API, in that we
have an on_connect_cb that the user provides *that is ran on the libuv
thread*. In this callback, the user can accept() a connection, turning it
into a tcp_socket.. of course, before accepting, they have the option
of passing it to a new task, provided they *make the cb block until
the accept is done* .. this is because, in libuv, you have to do the
uv_accept call in the span of that on_connect_cb callback that gets fired
when a new connection comes in. thems the breaks..

I wanted to just get rid of this API, because the general proposition of
users always running code on the libuv thread sounds like an invitation
for many future headaches. the API restriction to have to choose to
immediately accept a connection (and allow the user to block libuv as
needed) isn't too bad for power users who could conceive of circumstances
where they would drop an incoming TCP connection and know what they're
doing, in general.

but as a general API, I thought this was a bit cumbersome, so I ended up
devising..

2. an API that is initiated with a call to `net::tcp::new_listener()` ..
has a similar signature to `net::tcp::listen()`, except that is just
returns an object that sort of behaves like a `comm::port`. Users can
block on the `tcp_conn_port` to receive new connections, either in the
current task or in a new task, depending on which API route they take
(`net::tcp::conn_recv` or `net::tcp::conn_recv_spawn` respectively).. there
is also a `net::tcp::conn_peek` function that will do a peek on the
underlying port to see if there are pending connections.

The main difference, with this API, is that the low-level libuv glue is
going to *accept every connection attempt*, along with the overhead that
that brings. But, this is a much more hassle-free API for 95% of use
cases and will probably be the one that most users will want to reach for.
2012-05-22 22:29:17 -07:00
doc doc: Fix as description in tutorial 2012-05-16 20:22:32 -07:00
man Updating the manpage and usage message 2012-01-30 19:02:20 -08:00
mk implement new borrow ck (disabled by default) 2012-05-09 17:00:19 -07:00
src std: splitting out tcp server API + tests 2012-05-22 22:29:17 -07:00
.gitignore Add config.stamp to .gitignore 2012-03-27 22:25:10 -07:00
.gitmodules Update libuv. 2012-02-02 17:39:47 -08:00
AUTHORS.txt Add Gareth Daniel Smith to AUTHORS.txt 2012-05-21 17:38:52 -07:00
configure Update llvm and integrate clang and compiler-rt. 2012-04-30 17:48:38 -07:00
INSTALL.txt Bump version in INSTALL.txt 2012-03-28 22:45:13 -07:00
LICENSE.txt Add Clay license info to LICENSE.txt 2012-05-03 12:50:32 -07:00
Makefile.in build: pass RUSTFLAGS to the compiler 2012-05-19 18:27:16 -07:00
README.txt Rename some readmes and fix some dist logic. 2012-01-17 16:50:13 -08:00
RELEASES.txt Fix typo in release notes. 2012-03-28 13:52:47 -07:00

This is a compiler and suite of associated libraries and documentation for the
Rust programming language.

See LICENSE.txt for terms of copyright and redistribution.

See http://www.rust-lang.org for more information.