Commit Graph
60 Commits
Author SHA1 Message Date
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
Thomas de Zeeuw 23a0e990d2 return TcpStreamNew for TcpStream::connect_std (#66) 2017-12-06 14:59:57 -06:00
Thomas de Zeeuw 402cd3034d Avoid allocation when return a WouldBlock io::Error (#65) 2017-12-06 10:32:58 -06:00
Thomas de Zeeuw cf793d4053 Derive debug on public structs (#62)
* Derive Debug on all public structs

* Enable a warning about missing debug implementations on public struct
2017-12-06 10:19:21 -06:00
Alex Crichton 2e58422890 Add TcpListener::accept_std as a method
This should allow configuration over what reactor accepted streams go on to by
giving back a libstd-bound object that can then be used later in conjunction
with `TcpStream::from_std`.
2017-12-05 08:48:17 -08:00
Alex Crichton e86fc4917a Change need_read and need_write to return an error
This commit is targeted at solving tokio-rs/tokio-core#12 and incorporates the
solution from tokio-rs/tokio-core#17. Namely the `need_read` and `need_write`
functions on `PollEvented` now return an error when the connected reactor has
gone away and the task cannot be blocked. This will typically naturally
translate to errors being returned by various connected I/O objects and should
help tear down the world in a clean-ish fashion.
2017-12-05 08:43:01 -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
Alex Crichton 329bca15a6 Remove TcpListener::pending_accept field
No need for oneshot shenanigans as now we'll always have the `Handle` available
to us regardless of what thread we're on to associate a new socket
2017-12-05 08:17:08 -08:00
Alex Crichton 7c768fc046 Remove the Remote type
The `Handle` type is now `Send` and `Sync` so the `Remote` type no longer needs
to exist.
2017-12-05 08:15:26 -08:00
Thomas de Zeeuw c801584d24 Doc improvements (#46)
* small doc cleanups in PollEvented

* small doc cleanups in IoToken

* improve crate level documentation

- Add links to the futures, mio and tokio-uds crates.
- Add links to various structs and types mentioned.
- use eprintln for error reporting in the example.

* improvements to the UdpSocket documentation

- Fixed links usage.
- Removed references to a no longer existing `Window` struct.
- Made notes about using functions in context of a future.

* documentation improvements to UdpFramed and UdpCodec

- Since HTTP uses TCP (QUIC aside) using it as an example in an UDP
protocol feels wrong.
- Make the note of tampering with the underlying streams more explicit.

* update reactor module level documentation

Adds an explanation of every public struct.

* expand Handle and Remote documentation

* expand net module documentation

Adds an explanation of every public struct and how they work together.

* update TcpListener documentation

Reorder the various option methods; get first then set.
Note about panicing added to poll_read.

* remove mention of none-existing future R

* improve documentation of TcpStream

* fix UdpSocket doc

This when wrong when merging various commits.
2017-12-05 09:55:25 -06: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
Taylor Cramer 3588f4d6ad Simplify UdpSocket futures 2017-10-27 10:10:55 -07:00
Alex Crichton ca8104ad69 Merge pull request #272 from cramertj/must-use
Set Future types as must_use
2017-10-27 12:19:21 -04:00
Taylor Cramer 7624061021 Set Sink types as must_use 2017-10-25 18:03:31 -07:00
Taylor Cramer bd9a07f3ad Set Stream types as must_use 2017-10-25 18:02:14 -07:00
Taylor Cramer b4fa47bd09 Set Future types as must_use 2017-10-25 17:57:25 -07:00
Taylor Cramer 6b8ad4ff99 Fix warnings 2017-10-25 17:27:24 -07:00
Alex Crichton 84916f66fd Take &SocketAddr in connect 2017-10-05 10:47:57 -07:00
Alex Crichton 25760609fa Avoid 0-length IoVec instances
These are unsound on Windows (unfortunately) and will soon be disallowed due to
carllerche/iovec#5
2017-10-05 10:41:05 -07:00
Ben Boeckel de33e02c01 docs: fix some typos 2017-09-14 16:19:45 -04:00
Bastian Köcher c80105fe1e Adds UdpSocket connect, send and recv methods 2017-09-12 14:00:55 +02: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
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
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
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
Carl Lerche 7acffe4785 Expose TCP socket options 2017-05-27 09:37:25 -07:00
Alex Crichton b92fd2d22a Update to latest mio version 2017-05-19 10:00:57 -07: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 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
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 c9d0fe59dd Add a fast path to TcpListener::accept 2017-01-23 20:12:01 -08:00
Alex Crichton 64c360c30e Touch up TcpStream::connect and revert breaking change 2017-01-06 11:37:46 -08: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 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
Dawid Ciężarkiewicz 1864ecc46f tcp: Express incoming in terms of accept 2016-12-16 11:07:08 -08: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
Alex Crichton 7f96b7e9e4 Add some more public exports 2016-11-22 15:36:19 -08:00