Commit Graph

503 Commits

Author SHA1 Message Date
Tim
2c09a35705 Remove the Send bound from FutureService (#96)
* Make a reactor handle mandatory for server.

This removes the Send bound from FutureService. The Send bound
is still required for SyncService, since clones are sent to
new threads for each request. (This is more fodder for the argument
that there should be a distinct Options struct for each combination of
async/sync and client/server.)

This commit also makes FutureService::listen return an io::Result
rather than a Future; the future was never really necessary and
had the unintended consequence of making SyncService::listen
deadlock when the options specified a handle (because that means
the reactor driving the service lives on the same thread that
SyncService is waiting on).

`SyncClient` is no longer `Clone` because it needs to create
a new `reactor::Core` when cloning. Tokio Clients are `Clone` but
they don't allow moving the cloned client onto a new reactor.

* Change pubsub to use Rc<Refcell<>> instead of Arc<Mutex<>>.

This is possible since services no longer need to be Send.

* Remove some unnecessary unstable features.

There 3 remaining unstable features. The hardest to remove is plugin, because
we rely on compiler plugins to rewrite types from snake case to camel. It's
possible this can be removed before the proc macros rewrite lands if
impl Trait is extended to work with traits.

* Clean up example

* Sync servers now spawn a reactor on a thread. It's decided that
   sync users should not have to know about tokio at all.

* Don't allow specifying a reactor::Core on client options.

* Fail fast in server::listen if local_addr() returns Err.
2017-02-15 23:47:35 -08:00
Adam Wright
6bf4d171c1 Merge pull request #99 from tikue/deps-cleanup
Remove unused deps: bytes, take, and scoped-pool
2017-02-15 20:57:08 -08:00
Adam Wright
0f52b08426 Merge branch 'master' into deps-cleanup 2017-02-15 20:49:53 -08:00
Cyril Plisko
acdf03c8ca Fix compilation error for benches (#101) 2017-02-15 09:26:57 -08:00
Adam Wright
b2f69faa13 Merge pull request #92 from tikue/sync-reactor
Change SyncClient to drive its own execution with an internal reactor::Core.
2017-02-13 21:37:49 -08:00
Tim Kuehn
2749d33f88 Merge master into sync-reactor. 2017-02-13 21:29:39 -08:00
compressed
338c91d393 fix(bincode): updates to support bincode 1.0.0-alpha2 (#100)
Removed:
- `Error::ClientDeserialize` variant
- `Error::ServerDeserialize` variant
- `WireError::ServerDeserialize` variant
2017-02-12 14:52:38 -08:00
Tim Kuehn
fa2df184e9 Remove unused deps: bytes, take, and scoped-pool 2017-02-07 20:34:52 -08:00
compressed
a1072c8c06 Upgrade serde to 0.9 (#94)
* feat(serde): upgrade serde to 0.9

If you are using `#[derive(Serialize, Deserialize)]` or implementing
your own (de)serialization behavior for your RPC types you will need to
ensure you are using serde 0.9.x.

[breaking-change]

* chore(byteorder): upgrade byteorder to 1.0
2017-02-02 13:36:19 -08:00
Tim Kuehn
ed90f4ecea Merge master into sync-reactor 2017-02-01 22:48:49 -08:00
Tim Kuehn
b5bf696017 Merge master into sync-reactor 2017-02-01 22:39:19 -08:00
Tim Kuehn
fe20c8af14 Add a reactor::Core field to SyncClient.
This allows the client to drive its own execution, as one would expect.
Previously, the reactor had to be driven on a separate thread, which was confusing.
This has a couple notable side effects:
  1. SyncClient is no longer `Clone`.  This is because `reactor::Core`
     is not `Clone`, and creating one is not infallible
     (`Core::new` returns a `Result`).
  2. SyncClient does not use the user-specified `client::Options::handle` or
     `client::Options::remote`, because it constructs its own reactor.
2017-02-01 22:32:25 -08:00
Adam Wright
2ffa1138dd Merge pull request #91 from tikue/master
Temporary workaround for compiler bugs in impl Trait feature.
2017-02-01 21:05:33 -08:00
Tim Kuehn
9d552e48a4 Temporary workaround for compiler bugs in impl Trait feature. 2017-02-01 15:52:30 -08:00
compressed
fafe569ebc Add TLS support (#81)
When `-- features tls` is specified for tarpc, RPC communication can
also occur over a `TlsStream<TcpStream>` instead of a `TcpStream`.

* The functional tests have been refactored to use a common set of
functions for constructing the client and server structs so that all
the tests are shared across non-tls and tls test runs.

* Update pre-push to test TLS

* The `cfg_attr` logic caused many false warnings from clippy, so for now the crate docs for TLS are not tested.
2017-01-31 10:21:13 -08:00
Adam Wright
c286c596bd Merge pull request #85 from tikue/master
Make port reusable
2017-01-30 22:46:29 -08:00
Tim Kuehn
348111a423 Add test for reusing addr:port 2017-01-30 17:11:31 -08:00
Tim Kuehn
984c1c29c5 Make port reusable 2017-01-30 15:51:22 -08:00
Adam Wright
cc1290636d Merge pull request #82 from tikue/master
Make sure synchronous RPCs are wrapped in a lazy future.
2017-01-23 00:48:10 -08:00
Tim Kuehn
41683eee1d Change variable obfuscation style from prefix underscores to suffix underscores. 2017-01-22 22:41:06 -08:00
Tim Kuehn
6c2239d6f2 Cargo clippy 2017-01-22 21:16:11 -08:00
Tim Kuehn
3196fd91ff Cargo fmt 2017-01-22 20:08:38 -08:00
Tim Kuehn
45fa4c7bf1 Make sure synchronous RPCs are wrapped in a lazy future.
Some future-returning fns implicitly require the presence of an execution task. Wrapping in a lazy future ensures that by the time the future is polled, there is a task present.
2017-01-22 19:39:19 -08:00
Adam Wright
c7c18cbaaa Merge pull request #78 from tikue/master
Simplify Never impls: return the inner uninhabited type for fns taking &self.
2017-01-22 15:31:43 -08:00
Adam Wright
1c0cf2a67f Merge branch 'master' into master 2017-01-22 15:27:45 -08:00
Adam Wright
15a3900f3d Merge pull request #79 from tikue/private-items
Make private a couple items that no longer need to be public.
2017-01-22 15:23:59 -08:00
Adam Wright
f0ecd7008d Merge branch 'master' into private-items 2017-01-22 15:13:32 -08:00
Adam Wright
3567202aa3 Merge pull request #80 from tikue/client-reexports
Don't reexport client implementation details from crate root.
2017-01-22 15:13:22 -08:00
Tim Kuehn
802ee838ca Don't reexport client implementation details from crate root. 2017-01-17 16:38:30 -08:00
Tim Kuehn
c976ca710a Make private a couple items that no longer need to be public. 2017-01-17 15:36:08 -08:00
Tim Kuehn
9d2d69b4f4 Simplify Never impls: return the inner uninhabited type for fns taking &self. 2017-01-17 15:25:48 -08:00
Adam Wright
558dda28ad Merge pull request #75 from tikue/master
Add Options to all connect and listen fns
2017-01-15 17:21:30 -08:00
Tim
4a4ffab611 Merge branch 'master' into master 2017-01-15 17:07:18 -08:00
Tim Kuehn
cabbbb2a0b Fix some doc comments and remove unused impl. 2017-01-15 17:00:04 -08:00
compressed
3dc1b6381d fix(futures): Either was only added in 0.1.7 (#76) 2017-01-13 15:21:07 -08:00
Adam Wright
c96ab77dcf Merge pull request #74 from shaladdle/docs
First pass at some more detailed documentation
2017-01-13 15:15:09 -08:00
Adam Wright
865712f36e First pass at some more detailed documentation 2017-01-12 20:11:03 -08:00
Tim Kuehn
a8e5bc45a1 Minor refactor 2017-01-12 00:31:46 -08:00
Tim Kuehn
95c57a4b2d Add Options to all connect and listen fns 2017-01-12 00:06:17 -08:00
Adam Wright
ab3e73812c Merge pull request #73 from tikue/master
Remove readme_expanded
2017-01-11 23:32:51 -08:00
Tim Kuehn
d34ca2acda Remove readme_expanded 2017-01-11 23:29:19 -08:00
Adam Wright
9e92666932 Merge pull request #72 from tikue/master
Fix readme examples
2017-01-11 23:29:06 -08:00
Tim Kuehn
a6b25dc268 Fix readme examples 2017-01-11 23:14:52 -08:00
Adam Wright
77e12f56cc Merge pull request #71 from tikue/master
Rework the future Connect trait to only have one method, which takes …
2017-01-11 23:03:58 -08:00
Tim Kuehn
05c6be192d Rework the future Connect trait to only have one method, which takes an Options arg. 2017-01-11 22:55:04 -08:00
Adam Wright
568484f14f Merge pull request #70 from tikue/master
Make spawn_core private
2017-01-11 21:00:15 -08:00
Tim Kuehn
918b6b3b75 Make spawn_core private 2017-01-11 20:44:59 -08:00
Adam Wright
d5854fd049 Merge pull request #69 from tikue/remove-error-trait
Remove unnecessary trait
2017-01-11 20:41:48 -08:00
Adam Wright
9646d92cae Merge pull request #68 from tikue/master
Remove unused macro code
2017-01-11 20:27:46 -08:00
Tim Kuehn
a660ed7f1a Remove unnecessary trait 2017-01-11 20:27:17 -08:00