Commit Graph
222 Commits
Author SHA1 Message Date
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 e0b751b013 Relax exact interval tests
Should make this more resilient to rounding errors on Windows
2017-09-11 07:44:32 -07:00
Travis Bischel b9dc4c9008 TokenTimeout: add doc around new panic
My slab bump in #246 added a potential new panic in Core's Inner's
`cancel_timeout`.

Thankfully, the only way `cancel_timeout` can be called is from
TimeoutToken's `cancel_timeout`, which is crate-internal only and is
only called from Timeout's and Interval's drop fn's.

This change simply adds new clarifying documentation around
TokenTimeout's cancel_timeout to "future proof" anybody looking to use
cancel_timeout directly (not just on drop).
2017-09-08 22:31:37 -07:00
Travis Bischel fce59de79e bump slab to 0.4.0
Makes some of the code easier to read.
2017-09-07 20:53:54 -07:00
arthurprs f12b761b77 Prefer ErrorKind::WouldBlock 2017-09-03 18:39:04 +02:00
Alex Crichton e8617ea1fc Update futures dependency 2017-08-24 08:16:04 -07:00
Alex Crichton 77d9a1aa4f Merge pull request #226 from Ralith/udp-dual-stack
Expose only_v6 option for UDP sockets
2017-08-17 13:05:31 -07:00
cssivision e5fdccfff0 update example in doc comment 2017-08-16 19:17:12 +08:00
Raph Levien 05b1ba4342 [fuchsia] Config changes to build on Fuchsia
This patch disables various Unix-specific platform features that are
not enabled on Fuchsia. It also updates the mio version to 0.6.10,
which is the first release that supports Fuchsia.
2017-07-31 14:12:53 -07:00
Alex Crichton 77b0ee0a47 Hide the deprecated io module 2017-07-30 20:49:09 -07:00
manuels d03c736b4c Add documentation about panics to {Handle, Remote}::spawn{fn} 2017-07-26 17:33:09 +02:00
Guanqun Lu 5fe7b4225f typo fix in io_token's comment section 2017-07-12 13:21:54 +08:00
Alex Crichton c13e7f3533 Clarify docs on Timeout::reset 2017-06-27 09:55:36 -07:00
Yuanchao Sun 6fb62d3232 Add a method to reset Timeout. 2017-06-27 11:34:56 +08:00
Benjamin Saunders 8004900ce9 Expose only_v6 option for UDP sockets 2017-06-25 22:56:52 -07:00
Sean McArthur bf93b79120 make TcpStream::flush() a noop 2017-06-23 15:25:25 -07:00
Alex Crichton c65c331767 Merge pull request #210 from asomers/aio5
POSIX AIO support, try 2
2017-06-08 14:30:22 -05:00
Alan Somers 363e15f36c Respond to alexchrichton's comments
* Combine the FreeBSD/Dragonfly platform with the other Unix platform
* Remove the Windows platform::aio method
* Update deps
2017-06-07 22:36:32 -06:00
Alex Crichton 16d15520ad Update tokio-core with new task system 2017-05-30 08:42:32 -07:00
Carl Lerche 7acffe4785 Expose TCP socket options 2017-05-27 09:37:25 -07:00
Alan Somers 42f73cb0ec Revert changes to read_ready and add platform::all() 2017-05-21 11:01:48 -06:00
Alan Somers 81beb44565 POSIX AIO support, try 2
Support POSIX AIO, post-01635df .  A concrete implementation will be
added by the mio-aio and tokio-file crates
2017-05-21 10:24:08 -06:00
Alex Crichton 4dd3d30f2a Add PollEvented::poll_ready
This commit adds a general-purpose method for querying the readiness of a
`PollEvented` type. This new method, `poll_ready`, takes a blanket `mio::Ready`
and tests if any part of it is ready. The purpose of this is to expose
platform-specific events through `PollReady` such as `hup` and `error` events
other than just the platform-agnostic readable/writable events.

The semanatics of this method are:

* The `poll_ready` function takes a mask, and the return value is either
  `Async::Ready` with a subset of these events that are ready or `None` if none
  of them are ready.
* There can be up to two tasks blocked on a `PollEvented`, so we need to pick
  which one is suitable for these new events. Currently all events are routed to
  the `read` task unless the writable bit is set. This is mostly only relevant
  for multi-task usage or if you're manually calling `need_read` and/or
  `need_write`, and hopefully the docs will cover this now.
2017-05-19 11:23:00 -07:00
Alex Crichton b92fd2d22a Update to latest mio version 2017-05-19 10:00:57 -07:00
king6cong 4d8d293913 typo fix 2017-05-12 18:00:55 +08:00
Markus Jais 5567ec904e small typo fixed for io module 2017-05-09 21:02:09 +02:00
Nikolay Kim 0cfa98566e drop inner borrow before dropping task 2017-05-07 21:17:57 -07:00
Dan Munckton 3111443113 Update links to pages in the tokio.rs going-deeper section
See: tokio-rs/website#72
2017-04-25 19:26:43 +01:00
Alex Crichton 29144e6c9b Return NotReady from TcpStream::read_buf 2017-03-27 08:55:30 -07:00
Daniel Harding f5db8136d7 Fix logic error in TcpStream.read_buf()
If the underlying read_bufs() call returned a WouldBlock error,
TcpStream.read_buf() was erroneously calling self.io.need_write(), when
it should actually call self.io.need_read().
2017-03-27 16:54:56 +02:00
Alex Crichton 45e69bfb61 Return NotReady from TcpStream::write_buf
Closes #194
2017-03-27 07:33:18 -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 8c1838e093 Fix build on beta/nightly
I believe this happened due to a very recent rustc soundness fix!

Closes #189
2017-03-15 10:29:17 -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 b0d04e04f2 Merge pull request #174 from asomers/aioprep
Replace magic numbers with constants from mio
2017-03-07 08:58:37 -06:00
Alan Somers eb66ff3ad1 Replace more instances of magic numbers 2017-03-06 20:16:12 -07:00
Alex Crichton 5c411c548b Add Debug for {Handle,Remote,Core}
Closes #170
2017-03-06 12:16:09 -08:00
Alan Somers 3b8f1695ff Define constants to replace magic numbers 2017-03-05 14:38:55 -07:00
Denis Andrejew 1722d8ed45 fix typo in reactor::Core::run docs 2017-03-03 18:38:56 +00:00
Jan Zerebecki e8bd2117d0 Fix typo in docblock for Core::run() 2017-02-27 11:07:19 +01:00
Alex Crichton b773d55444 Tweak Debug output of PollEvented 2017-02-25 21:43:54 -08:00
Andy Grover 9e3f3caad0 Implement Debug for PollEvented<E> if E implements Debug
Useful, esp since mio::unix::EventedFd already implements Debug.

Signed-off-by: Andy Grover <[email protected]>
2017-02-24 12:57:05 -08:00
Martin Hoffmann 54dcd3a015 Add PartialOrd and Ord to EasyBuf, generalize PartialEq. 2017-02-18 20:30:01 +01:00
Sebastian Thiel fe9a798811 Implement PartialEq for EasyBuf 2017-02-13 07:55:26 +01:00
Sebastian Thiel 65c5c5241b Test semantics of buffer allocation of get_mut()
* if remaining bytes are smaller then 8 * 1024, allocate 8 * 1024
* otherwise allocate as much as needed to hold the remaining bytes
  without re-allocations.
2017-02-12 09:47:03 +01:00
Sebastian Thiel e11dd06ead Assure we don't have to allocate while growing the vector
We now have enough capacity to copy the unconsumed portion
of the previous frame.
2017-02-11 10:23:02 +01:00
Sebastian Thiel 5adde38a65 Allocation in get_mut() always uses 8 * 1024 bytes
The previous implementation would always use the capacity
of the previous buffer, which would effectively prevent it
from ever shrinking.

This also means that protocol with greater variance in
possible frame sizes would likely be heavily over-allocating.
If these implementations use zero-copy, this would imply
that even small frames kept alive by the client would use
large amounts of memory.

The change is motivated by the implementation of the
cassandra-protocol, which allows frames of up to 256MB
in size, which solely depend on the kind of query.
2017-02-11 09:01:07 +01:00
Manuel Woelker b4cd223476 impl Into<Vec<u8>> for EasyBuf (cf. #120) 2017-02-10 23:01:46 +01:00
Manuel Woelker f86addf113 fix allocating EasyBuf::get_mut() leaving vector too large (cf. #162) 2017-02-10 22:58:16 +01:00