159 Commits

Author SHA1 Message Date
Carl Lerche
ae627db266 Change net::Incoming signature to match std. (#89)
std's `Incoming` iterator yields `TcpStream` instances. This patch
updates the `Incoming` future to match this signature.

This changes the yielded value from `(TcpStream, SocketAddr)` ->
`TcpStream`.
2018-01-30 15:01:34 -06:00
Carl Lerche
fd37fb0f17 Merge remote-tracking branch 'core/master' into new-crate 2018-01-26 14:50:41 -08:00
Roman
025f52aadc Fix UdpCodec::encode (#85)
*     Refactor UDP SendDgram & RecvDgram

    Get rid of unnamed structs in the favor of private structs with named fields

*     Change the signature of UdpCodec::encode

    Now it is:

    ```
        fn encode(&mut self, msg: Self::Out, buf: &mut Vec<u8>) -> Result<SocketAddr, Self::Error>;
    ```

    Closes https://github.com/tokio-rs/tokio/issues/79

* Fix compilation error from `mio` crate
2018-01-16 08:49:59 -08:00
Bastien Orivel
b395ccb6d9 Bump dependencies (#289) 2018-01-02 12:03:54 -06:00
Alex Crichton
4ef772b2db Remove Handle argument from I/O constructors (#61)
This commit removes the `Handle` argument from the following constructors

* `TcpListener::bind`
* `TcpStream::connect`
* `UdpSocket::bind`

The `Handle` argument remains on the various `*_std` constructors as they're
more low-level, but this otherwise is intended to set forth a precedent of by
default not taking `Handle` arguments and instead relying on the global
`Handle::default` return value when necesary.
2017-12-12 18:32:50 -06:00
Alex Crichton
a577bfc033 Remove the Reactor::run method (#58)
This commit removes the `Reactor::run` method which has previously been used to
execute futures and turn the reactor at the same time. The tests/examples made
heavy usage of this method but they have now all temporarily moved to `wait()`
until the futures dependency is upgraded. In the meantime this'll allow us to
further trim down the `Reactor` APIs to their final state.
2017-12-11 21:29:18 -06:00
Alex Crichton
108e1a2c1a Blanket rename Core to Reactor
This commit uses a script to rename `Core` to `Reactor` all at once, notably:

    find . -name '*.rs' | xargs sed -i 's/\bCore\b/Reactor/g'
2017-12-05 09:02:07 -08:00
Alex Crichton
8fcce957cd Rename networking constructors with _std
This commit renames the various constructors of networking types to have a
`_std` suffix instead of a smorgasboard of other suffixes, canonicalizing on
`_std` as the suffix for constructors which take the libstd corresponding types.
2017-12-05 08:24:26 -08:00
Thomas de Zeeuw
0b54557796 Remove unused code (#44)
* remove unused #[macro_use] and #[allow(unused_macros)]

* remove unused FnBox trait

* remove unused temporary variable

* remove Evented trait requirement to implement Debug
2017-12-01 15:34:03 -06:00
Carl Lerche
9c16d47632 Merge remote-tracking branch 'core/master' into new-crate 2017-11-06 23:30:10 -08:00
Alex Crichton
1fe55b2b55 Don't unwrap accepted connections
Helps avoid spurious errors when testing.

Closes #277
2017-11-06 08:23:11 -08:00
Carl Lerche
c6f1ff13d2 Remove executor from reactor.
In accordance with tokio-rs/tokio-rfcs#3, the executor functionality of
Tokio is being removed and will be relocated into futures-rs as a
"current thread" executor.

This PR removes task execution from the code base. As a temporary
mesure, all examples and tests are switched to using CpuPool.

Depends on #19.
2017-11-01 07:28:49 -07:00
Carl Lerche
b23a997cb8 Remove deprecated code.
This commit removes code that was deprecated in tokio-core master.
2017-10-30 16:37:15 -07:00
Carl Lerche
36aaaa1520 Rename crate to tokio 2017-10-30 16:37:00 -07:00
Taylor Cramer
6b8ad4ff99 Fix warnings 2017-10-25 17:27:24 -07:00
Alex Crichton
0868b97832 Add a tinydb example sharing state
This example is intended to showcase sharing state between all connected clients
on a server, for example a key/value store (in-memory database)

Closes #257
2017-09-23 12:22:34 -07:00
Alex Crichton
8a43472b35 Add an example of compressing on a CPU pool 2017-09-11 14:41:15 -07:00
Alex Crichton
ecedea3404 Add a README for the examples 2017-09-11 13:31:08 -07:00
Alex Crichton
85257e19af Touch up a few examples 2017-09-11 08:43:11 -07:00
Alex Crichton
a611f6ec30 Add a UDP mode to the connect example 2017-09-11 08:33:09 -07:00
Alex Crichton
5e4cfdfab1 Recommend the connect example over nc 2017-09-11 08:07:38 -07:00
Alex Crichton
5e92b10f3f Add a "tiny" HTTP example
Hopefully being relatively illustrative in how a bare-bones non-production-ready
server can be spun up!
2017-09-10 21:45:23 -07:00
Alex Crichton
7b94cf307d Add a multithreaded echo server example 2017-09-10 08:54:35 -07:00
Alex Crichton
e8617ea1fc Update futures dependency 2017-08-24 08:16:04 -07:00
Alex Crichton
a8e09c5608 Add the proxy example from #100 2017-03-15 09:59:09 -07:00
Alex Crichton
89fcc96dd4 Migrate to using tokio-io
Deprecate the existing `io` module in this crate entirely.

More details coming soon!

Closes #61
2017-03-15 09:46:54 -07:00
king6cong
a67e0d3efb comment rewording 2017-03-07 11:39:51 +08:00
Justin Mayhew
c9a8208c8a Rename sender in connect example 2017-02-19 15:02:31 -04:00
Julian Tescher
baeb35b6d4
Fix typos 2017-01-24 20:52:48 -08:00
Patrick Barrett
0c553f958a
return implicitly (rather than both explicitly and implicitly) 2017-01-14 13:00:46 -06:00
Patrick Barrett
e502603532
use the 'Out' type in encode rather than copy/paste 2017-01-14 12:59:22 -06:00
Holger Rapp
58913c80a3 Fix typo. 2017-01-04 16:49:33 +01:00
Alex Crichton
717e99ca80 Fix connect example 2016-12-20 18:39:44 -08:00
Alex Crichton
99078c5cc1 Touch up comments on echo, add connect example 2016-12-20 17:59:46 -08:00
Alex Crichton
1a48b79474 Touch up examples to ensure consistency 2016-11-22 12:35:30 -08:00
Alex Crichton
9b62ade962 Touch up codes for UDP
* Move to `std::net` as it's all purely UDP related
* Rename to `UdpCodec` and `UdpFramed` to give a consistent `Udp` prefix
* Add `RecvDgram`, rename `SendDGram` to `SendDgram`
* Touch up some style here and there
2016-11-22 11:48:09 -08:00
Rick Richardson
2cb600bd19 changed CodecUdp::decode to return Self::In instead of Option<Self::In> 2016-11-22 08:29:02 -08:00
Rick Richardson
b12d32ce1c made send_dgram move self, made FramedUdp::new private, other clean-ups and tweaks 2016-11-21 11:28:25 -08:00
Rick Richardson
ab3915d47d forgot a = 2016-11-20 11:55:57 -08:00
Rick Richardson
161811de8b moved udp test to examples, optimized buffer handling 2016-11-20 11:40:43 -08:00
Alex Crichton
0f49a69a06 Deprecate the channel module
The `futures::sync::mpsc` module should entirely supplant it.
2016-11-18 15:20:39 -08:00
Kartik Singhal
be7992e639 This works only for IPv4 addresses 2016-11-09 12:10:07 -05:00
Kartik Singhal
71baa4967d Correct client invocation example 2016-11-09 11:41:37 -05:00
Alex Crichton
4744a2e48b No more need for lazy in chat example 2016-11-05 13:36:49 -07:00
David Renshaw
556143b7c6 Simply echo example: split() can now happen on the main task. 2016-11-05 15:16:29 -04:00
Alex Crichton
4615c3ea78 Touch up the echo examples 2016-11-02 16:57:27 -07:00
Dawid Ciężarkiewicz
237bcead7a Add UDP echo server example. 2016-11-02 16:30:37 -07:00
oberien
7cf7833631 fix(examples): Fix typos in chat example
Rephrase a sentence to not contain the word `join` when we are actually using
`select` to prevent confusion.
2016-10-14 23:03:46 +02:00
Alex Crichton
bc2f857236 Touch up the chat example 2016-10-13 11:36:32 -07:00
oberien
315f601822 ref(examples): Minor refactoring in chat example
* Move connections-clone down a bit
* Use `Ok` and `Err` as IntoFuture
2016-10-11 20:08:13 +02:00