diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-08-19 15:36:47 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-08-19 15:36:47 +0200 |
commit | 63637840a92f237b21369f2b8cb2c202d33613fc (patch) | |
tree | 0ee483ea20eae9bc63297ac8a2c75f4d56ccea4e /tool/src | |
parent | bcd5ab8751c14f4ac48a2ea8b7d90163eb306b5f (diff) |
net: Drop the sync variant.
- The sync wrapper hide the async nature of the implementation, and
while this may seem convenient, it may cause subtle problems if it
is invoked from a different event loop.
- Furthermore, 'async' is a reserved keyword in the 2018 edition,
requiring awkward escaping.
- Fixes #307.
Diffstat (limited to 'tool/src')
-rw-r--r-- | tool/src/sq.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tool/src/sq.rs b/tool/src/sq.rs index e84aa1c4..0e8a1439 100644 --- a/tool/src/sq.rs +++ b/tool/src/sq.rs @@ -10,6 +10,7 @@ extern crate tempfile; extern crate termsize; extern crate time; extern crate itertools; +extern crate tokio_core; use failure::ResultExt; use prettytable::{Table, Cell, Row}; @@ -116,6 +117,7 @@ fn real_main() -> Result<(), failure::Error> { builder = builder.home(dir); } let ctx = builder.build()?; + let mut core = tokio_core::reactor::Core::new()?; match matches.subcommand() { ("decrypt", Some(m)) => { @@ -326,7 +328,7 @@ fn real_main() -> Result<(), failure::Error> { output }; - ks.get(&id) + core.run(ks.get(&id)) .context("Failed to retrieve key")? .serialize(&mut output) .context("Failed to serialize key")?; @@ -336,7 +338,7 @@ fn real_main() -> Result<(), failure::Error> { let tpk = TPK::from_reader(&mut input). context("Malformed key")?; - ks.send(&tpk) + core.run(ks.send(&tpk)) .context("Failed to send key to server")?; }, _ => unreachable!(), @@ -473,7 +475,7 @@ fn real_main() -> Result<(), failure::Error> { // stderr and exit. // Because it might be created a WkdServer struct, not // doing it for now. - let tpks = wkd::get(&email_address)?; + let tpks = core.run(wkd::get(&email_address))?; // ```text // The HTTP GET method MUST return the binary representation of the // OpenPGP key for the given mail address. |