Commit Graph
43 Commits
Author SHA1 Message Date
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 697851210c Remove timers from Tokio.
In accordance with tokio-rs/tokio-rfcs#3, timers are being extracted
from Tokio and moved to a separate crate (probably futures-timer).

This PR removes timers from the code base.
2017-10-30 18:16:00 -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
Alex Crichton 335c3e73a4 Fix UDP test 2017-10-05 19:57:36 -07:00
Bastian Köcher 7950b43505 Adds a test for UdpSocket connect, recv and send 2017-09-12 14:37:40 +02:00
Alex Crichton 2e5cd1640e Merge pull request #250 from henninglive/udp-zero-length
UDP 0-length datagrams
2017-09-11 10:43:40 -05:00
Henning Ottesen bda6ed9241 UDP 0-length datagrams
Resolves #248, preventing UdpFramed from sending 0-length datagrams.
Also, adds 0-length tests for UdpSocket.
2017-09-11 17:32:37 +02:00
Alex Crichton a4e947fba0 Make timeout tests slightly more flexible 2017-09-10 19:58:35 -07:00
Alex Crichton 011a7b02f7 Add a test for spawn-in-drop 2017-05-08 16:18:42 -07:00
Alex Crichton 37e2870f04 Limit the scope of borrow_mut in consume_queue
Otherwise we may accidentally hold the borrowed ref cell for too long which can
cause a borrow error.

Closes #190
2017-03-15 22:59:08 -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
Alex Crichton f77fe7d3b5 Allow a bit of sloppiness in the timeout test 2017-01-10 16:14:54 -08:00
Alex Crichton f036691681 Clean up the pipe-hup test slightly 2016-12-08 16:30:18 -08:00
Andreas Rottmann dc27c0a524 Add test for EPOLLHUP without EPOLLIN
Note that this brings in a lot of machinery just for the sake of
wrapping file descriptors as PollEvented. This should maybe be moved
into the public API of some crate.
2016-12-08 17:52:40 +01:00
Alex Crichton b89150c464 Fixup Result-returning encode method 2016-11-22 15:22:30 -08:00
Paul Colomiets e27abd3841 Remove Framed::split because it's now in futures 2016-11-21 19:33:07 +02:00
Aaron Turon c353de13fc Reintroduce "decoder" and "encoder" for Decode and Encode, and merge the
traits into `Codec`

A previous commit refactored such that `Encode` and `Decode` are
implemented directly on the types being encoded or decoded. This was
thought to be less expressive but more convenient than having a separate
notion of a (stateful) encoder or decoder.

However, there are certain situations where the approach is just too
limiting: you're required to implemented `Decode` and `Encode` for types
you don't "own" and can't newtype.

This commit moves back to a setup where `Self` represents the
encoder/decoder state; it also merges the two traits into a single
`Codec` trait, since they are currently always used together.
2016-11-15 08:28:26 -08:00
Alex Crichton 092574b7de Merge branch 'aphs-core-stream' of https://github.com/aidanhs/tokio-core 2016-11-11 14:06:03 -08:00
Alex Crichton 45fc13071c Fix line-frames test 2016-11-08 17:59:37 -08:00
Aaron Turon 36e3dbf418 Refactor framing to use Streams and Sinks
- Gets rid of `easy` module, instead providing framing support directly
  in the `io` module.

- In particular, adds a framing adapter directly to the `Io` trait,
  which gives you a Stream + Sink object. That object can then be
  `split` into separate `Stream` and `Sink` objects if needed.

- Deprecates the `FramedIo` trait; that's now just Stream + Sink.

- Updates the line framing test to use the stream/sink combinators.
2016-11-08 15:47:13 -08:00
Aidan Hobson Sayers fce913c04d Add turn on Core to allow single event loop iterations 2016-11-06 22:11:18 +00:00
Aaron Turon 503f4a0405 Polish tokio-core in prep for overall 0.1 release
This commit makes a few tweaks to the new `easy` module:

- Rename `Parse` to `Decode`, and `Serialize` to `Encode`.

- Don't use `Poll` for the `decode` method; we prefer to reserve
  that type for actual aync events, and in particular for a `NotReady`
  result to imply that some task scheduling has taken place. Instead,
  use an internal `Option`.
2016-10-25 15:15:18 -07:00
Alex Crichton 6d6c2aa390 Fix tests 2016-10-21 17:01:43 -07:00
Alex Crichton b84ef90a98 Move Framed from tokio-proto to core
This commit extracts the concrete implementation of `FrameIo` in tokio-proto to
tokio-core under the name `EasyFramed`. This extraction is accompanied with a
new `EasyBuf` buffer type to work with when parsing types.

The purpose of this movement is to provide a clear and easy entry point at the
`FramedIo` layer for those who need it. Eventually these buffer types will get
replaced or moved to the `bytes` crate, but in the interest of an 0.1 release
and remaining backwards compatible with the tokio-core 0.1 release this is
adding a separate module.
2016-10-21 11:46:32 -07:00
Paul Colomiets b1d02eb598 Implement tokio_core::reactor::Interval 2016-10-10 15:41:57 +03:00
Alex Crichton 83784fd983 Don't remove timeouts that have fired
Closes #22
2016-09-08 07:47:07 -07:00
Alex Crichton 66cff8e84b Swap Handle/Pinned
* Handle -> Remote
* Pinned -> Handle

All APIs now take a `&Handle` by default and in general can return an immediate
`io::Result` instead of an `IoFuture`. This reflects how most usage will likely
be done through handles rather than remotes, and also all previous functionality
can be recovered with a `oneshot` plus `Remote::spawn`.

Closes #15
2016-09-07 22:12:41 -07:00
Alex Crichton e60002b653 Tweak TaskIo wording and such
* Remove TaskIo
* task_split -> split
* TaskIoRead -> ReadHalf
* TaskIoWrite -> WriteHalf

Closes #18
2016-09-07 22:12:14 -07:00
Alex Crichton 6c045d31ac Reorganize the entire crate:
Renamed APIs

* Loop => reactor::Core
* LoopHandle => reactor::Handle
* LoopPin => reactor::Pinned
* TcpStream => net::TcpStream
* TcpListener => net::TcpListener
* UdpSocket => net::UdpSocket
* Sender => channel::Sender
* Receiver => channel::Receiver
* Timeout => reactor::Timeout
* ReadinessStream => reactor::PollEvented
* All `LoopHandle` methods to construct objects are now free functions on the
  associated types, e.g. `LoopHandle::tcp_listen` is now `TcpListener::bind`
* All APIs taking a `Handle` now take a `Handle` as the last argument
* All future-returning APIs now return concrete types instead of trait objects

Added APIs

* io::Io trait -- Read + Write + ability to poll

Removed without replacement:

* AddSource
* AddTimeout
* IoToken
* TimeoutToken

Closes #3
Closes #6
2016-09-07 22:12:14 -07:00
Alex Crichton 3794cf7f1d Update with Poll/Async changes 2016-09-02 12:17:38 -07:00
Alex Crichton 330ab823b0 Update to futures master
* Remove `LoopData` as it's no longer necessary
* Add `LoopHandle::spawn` to spawn new futures onto an event loop
* Add `LoopData::spawn` to also spawn new futures onto an event loop
* Rejigger the implementation of the event loop a bit (make a slab of futures),
  but otherwise everything else is pretty constant.
2016-08-31 19:00:42 -07:00
Alex Crichton f107c8d860 Rename to tokio-core, add in futures-io
Renames the futures-mio crate to tokio-core, pulls in the futures-io crate under
an `io` module, and gets everything compiling.
2016-08-26 14:39:47 -07:00
Jean Pierre Dudey 9c309af597 Update futures-mio tests 2016-08-21 11:30:59 -04:00
Alex Crichton 32eb457dad Relax the 'static bound on Loop::run
We know that the future will never persist beyond this stack frame, so we can
just leave its ownership on the stack frame itself and receive notifications off
the event loop that we need to poll it.
2016-08-17 23:34:44 -07:00
Alex Crichton 311bfa07a3 Update futures-minihttp 2016-08-17 18:41:34 -07:00
Alex Crichton d0b911189c Re-work I/O
* Auto-register interest whenever we see WouldBlock
* Remove implementations of `Stream<Item=Ready>`, no longer needed
* Add explicit `poll_{read,write}` methods, if needed
* Remove all I/O streams, libstd ones suffice
* Update all I/O futures
2016-08-17 18:41:34 -07:00
Alex Crichton 293d104177 Remove Future::schedule
A more appealing model is actually just automatically inferring what needs to be
scheduled based on what actions are done during poll. For example if during a
poll you check a oneshot channel, then the current task is registered for being
woken up if it's not ready. Similarly this will apply to I/O where if I/O is
attempted but we see EAGAIN then we'll schedule the task to get notified when
it's ready.

This may also have performance benefits in some niche situations because you
don't need to recompute where you are in the state machine both during poll and
during schedule. Instead, it now happens all at once.
2016-08-17 18:41:34 -07:00
Alex Crichton 62f306629d Keep polling in Buffered if there's more futures
We're not NotReady until we hit the final future and it's not done.
2016-08-15 16:22:09 -07:00
Alex Crichton 8eb1f681af Don't export the timer_wheel module
Move tests into that module
2016-08-05 09:44:00 -07:00
Alex Crichton 5c9daad88b Add a timer wheel 2016-08-03 22:57:07 -07:00
Alex Crichton 1d7098eece Add a simple UDP test 2016-08-02 23:56:01 -07:00
Alex Crichton bc64194be1 Let's rename everything! 2016-07-30 22:50:58 -07:00