Commit Graph
167 Commits
Author SHA1 Message Date
Sean McArthur 829563ccfc add read_bufs and write_bufs to Io and TcpStream 2017-01-27 11:32:08 -08:00
Alex Crichton a4b4d57cb7 Touch up TcpStream::from_stream 2017-01-24 16:39:01 -08:00
Alex Crichton 4363663dea Merge pull request #158 from GuillaumeGomez/from_stream
Add from_stream method
2017-01-24 16:37:28 -08:00
Guillaume Gomez c1f1320203 Add from_stream method 2017-01-24 23:49:50 +01:00
Alex Crichton 5b425dfed9 Remove unneeded macro_use 2017-01-23 20:16:12 -08:00
Alex Crichton c9d0fe59dd Add a fast path to TcpListener::accept 2017-01-23 20:12:01 -08:00
Alex Crichton b22b797278 Add a function to upgrade a Remote to a Handle
Intended for fast paths which can be a little more optimized for when they're
run directly on the event loop.
2017-01-23 20:11:37 -08:00
Alex Crichton e69b67fcfe Remove extraneous clone in Remote 2017-01-23 20:06:03 -08:00
Manuel Woelker b9e182a2ce impl fmt::Debug for EasyBuf (cf. #120)
Debug format looks like this for small resp. long buffers

EasyBuf{len=2/6 [5, 6]}
EasyBuf{len=255/255 [0, 1, 2, 3, ..., 251, 252, 253, 254]}
2017-01-22 21:10:48 +01:00
Michal 'vorner' Vaner 8d02a1c2b6 Provide a publicly-accessible Core ID
Allow distinguishing between multiple `Core`s and associating data with
them through a `HashMap` or similar.
2017-01-17 22:09:31 +01:00
Alex Crichton d0833074d6 Move from a custom channel to futures::sync
Closes #143
2017-01-11 11:35:45 -08:00
Alex Crichton c47c445be6 Add some docs links and such 2017-01-11 09:47:12 -08:00
Alex Crichton 1985eae7f5 Point to tokio.rs 2017-01-11 09:14:50 -08:00
Alex Crichton 9294b1345c Touch up some docs in tokio-core 2017-01-10 10:02:15 -08:00
critiqjo 372d55ce0b Docs: Remove outdated reference to task::poll_on 2017-01-10 10:09:47 +05:30
Alex Crichton 64c360c30e Touch up TcpStream::connect and revert breaking change 2017-01-06 11:37:46 -08:00
Alex Crichton 2499dd35a2 Merge branch 'master' of https://github.com/alreece45/tokio-core 2017-01-06 11:30:18 -08:00
critiqjo e5bbf004d3 Update the use of deprecated APIs
For stuff that moved from futures::task to futures::executor
2017-01-05 20:41:36 +05:30
sinkuu 5929a59aca Use io::Result 2017-01-04 17:47:20 +09:00
Alexander Reece 3dd4178bb5 Update TcpStream::connect_stream() to return TcpStreamNew 2016-12-20 20:41:13 -05:00
Alexander Reece 000e9b5ab9 Change TcpStream::new() and TcpStream::connect() to return concrete types. 2016-12-20 20:41:13 -05:00
Alex Crichton 50f007a49b Add #![doc] to crate root 2016-12-19 22:41:41 -08:00
Steven Fackler 24d941d676 Encode/Decode -> Codec in docs 2016-12-19 22:19:39 -08:00
Aaron Turon 46d68f739a Add Clone for EasyBuf 2016-12-17 14:17:52 -08:00
Aaron Turon 9bb1366f33 Add From<Vec<u8>> for EasyBuf 2016-12-17 14:16:47 -08:00
Alex Crichton ef89def808 Touch up docs of TcpListener::accept 2016-12-16 11:15:34 -08:00
Alex Crichton edf6a57450 Minor tweaks w/ TcpListener::accept 2016-12-16 11:13:08 -08:00
Alex Crichton 68a8f26b40 Merge pull request #106 from dpc/tcplistener-accept
Implement `TcpListener::accept()`
2016-12-16 11:10:20 -08:00
Dawid Ciężarkiewicz 1864ecc46f tcp: Express incoming in terms of accept 2016-12-16 11:07:08 -08:00
David Renshaw 7abe6db0ae initialize slabs with capacity of one 2016-12-16 13:37:59 -05:00
Dawid Ciężarkiewicz 936727fa52 Don't block in TcpListener::accept
Instead hold a pending Future of the next `TcpStream`.
2016-12-16 10:35:42 -08:00
Dawid Ciężarkiewicz 38df0d7f0f Implement TcpListener::accept() 2016-12-16 10:35:42 -08:00
Andreas Rottmann 5bab8e85b9 Handle hup events as indicating read readiness
Using Linux's `epoll(7)` interface, a `EPOLLHUP` condition is
signalled for the reading end of a pipe or socket when the other end
is closed for writing. This may happen in combination with `EPOLLIN`
being signalled (if further data is available for reading), or with
`EPOLLIN`.

If `EPOLLHUP` is signalled without `EPOLLIN` it indicates an immediate
EOF condition, which will result in the next `read()` suceeding with 0
bytes read. It is thus not required to handle `EPOLLHUP` specially in
the reader, but we need to indicate readiness upon encountering it.

Looking at the `kqueue` and `windows` mio backends, they seem to be
turn a detected EOF and connection reset into `mio::Ready::hup()`
events, so it may be reasonable to speculate that this change is an
improvement for these platforms as well.

Fixes #117.
2016-12-08 17:52:40 +01:00
Alex Crichton 7f96b7e9e4 Add some more public exports 2016-11-22 15:36:19 -08:00
Alex Crichton b89150c464 Fixup Result-returning encode method 2016-11-22 15:22:30 -08:00
Alex Crichton e970e9a79c Merge branch 'master' of https://github.com/colindjk/tokio-core 2016-11-22 13:07:01 -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
Alex Crichton 0d10b0e05a Merge branch 'udp_frame' of https://github.com/rrichardson/tokio-core 2016-11-22 09:44:29 -08:00
Rick Richardson 1a6753df1f added Default Codec for Udp 2016-11-22 08:47:57 -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
Paul Colomiets e27abd3841 Remove Framed::split because it's now in futures 2016-11-21 19:33:07 +02:00
kibbles dcf994d517 Updated 'encode' return value to Result, removed parameter passing buffer 2016-11-20 21:44:23 -05:00
Rick Richardson 161811de8b moved udp test to examples, optimized buffer handling 2016-11-20 11:40:43 -08:00
Rick Richardson 71d8672aab implemented moste of udp frames test 2016-11-20 09:08:03 -08:00
Rick Richardson 592a99bca4 completed basic implementation of FramedUdp for streams and sink 2016-11-19 09:05:00 -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
Dan Burkert 46dd38b7d7 Clean up Sink implementation on Framed
This commit makes a few changes to the Sink implementation on Framed:

* Backpressure is implemented for `start_send`. If the write buffer is
  over 8KiB and can't be flushed, no new items are accepted.
* 0 length writes to the upstream transport are translated into a
  `WriteZero` error, as with `io::Write::write_all`. `write_all` checks
  for and ignores `Interrupted` errors, but I do not think this is
  necessary for non-blocking writes.
* In `poll_complete`, the upstream transport is not flushed until
  *after* writing the entire write buffer.
2016-11-16 18:42:30 -08:00
Alex Crichton 89a9ab6d34 Merge pull request #102 from aturon/decoder-encoder
Reintroduce "decoder" and "encoder" for Decode and Encode, merging them into Codec
2016-11-15 10:42:34 -06: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