summaryrefslogtreecommitdiffstats
path: root/sq
diff options
context:
space:
mode:
authorIgor Matuszewski <igor@sequoia-pgp.org>2020-10-20 22:40:42 +0200
committerIgor Matuszewski <igor@sequoia-pgp.org>2020-10-23 12:05:55 +0200
commit3fc8654d33c8c57542250eda8e910a2ffa0b8a81 (patch)
tree4008d9cc242f4f1ed8cb839977de3e7668aa648d /sq
parentc034cee8ff87c2d8e96952eea073d33c8be80d51 (diff)
sq: Migrate to tokio 0.2
Diffstat (limited to 'sq')
-rw-r--r--sq/Cargo.toml2
-rw-r--r--sq/src/sq.rs12
2 files changed, 8 insertions, 6 deletions
diff --git a/sq/Cargo.toml b/sq/Cargo.toml
index 7350a517..fe88d628 100644
--- a/sq/Cargo.toml
+++ b/sq/Cargo.toml
@@ -36,7 +36,7 @@ itertools = "0.9"
prettytable-rs = "0.8.0"
tempfile = "3.0.4"
crossterm = "0.13"
-tokio-core = "0.1"
+tokio = { version = "0.2", features = ["rt-core", "io-util", "io-driver"] }
rpassword = "5.0"
[build-dependencies]
diff --git a/sq/src/sq.rs b/sq/src/sq.rs
index 31107e93..940c49f9 100644
--- a/sq/src/sq.rs
+++ b/sq/src/sq.rs
@@ -1,7 +1,6 @@
/// A command-line frontend for Sequoia.
use crossterm;
-use tokio_core;
use crossterm::terminal;
use anyhow::Context as _;
@@ -183,7 +182,10 @@ fn main() -> Result<()> {
builder = builder.home(dir);
}
let ctx = builder.build()?;
- let mut core = tokio_core::reactor::Core::new()?;
+ let mut rt = tokio::runtime::Builder::new()
+ .basic_scheduler()
+ .enable_io()
+ .build()?;
match matches.subcommand() {
("decrypt", Some(m)) => {
@@ -433,7 +435,7 @@ fn main() -> Result<()> {
let id = id.unwrap();
let mut output = create_or_stdout(m.value_of("output"), force)?;
- let cert = core.run(ks.get(&id))
+ let cert = rt.block_on(ks.get(&id))
.context("Failed to retrieve key")?;
if ! m.is_present("binary") {
cert.armored().serialize(&mut output)
@@ -446,7 +448,7 @@ fn main() -> Result<()> {
let cert = Cert::from_reader(&mut input).
context("Malformed key")?;
- core.run(ks.send(&cert))
+ rt.block_on(ks.send(&cert))
.context("Failed to send key to server")?;
},
_ => unreachable!(),
@@ -583,7 +585,7 @@ fn main() -> Result<()> {
// stderr and exit.
// Because it might be created a WkdServer struct, not
// doing it for now.
- let certs = core.run(wkd::get(&email_address))?;
+ let certs = rt.block_on(wkd::get(&email_address))?;
// ```text
// The HTTP GET method MUST return the binary representation of the
// OpenPGP key for the given mail address.