diff options
author | Wez Furlong <wez@wezfurlong.org> | 2020-01-18 15:50:36 -0800 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2020-01-18 15:50:36 -0800 |
commit | ebea1cce2a4c550ad11dbf10c20ab2379a37a0e2 (patch) | |
tree | 0281e763942c262b95bec85fd2b736d3cef8c342 /Cargo.toml | |
parent | 4011e518e6455bb4f0a2de0aaba3763b964d0e58 (diff) | |
download | ssh2-rs-ebea1cce2a4c550ad11dbf10c20ab2379a37a0e2.zip |
Make properly Send safe
In earlier iterations I accidentally removed Send from Session and then
later restored it in an unsafe way. This commit restructures the
bindings so that each of the objects holds a reference to the
appropriate thing to keep everything alive safely, without awkward
lifetimes to deal with.
The key to this is that the underlying Session is tracked by an
Arc<Mutex<>>, with the related objects ensuring that they lock this
before they call into the underlying API.
In order to make this work, I've had to adjust the API around iterating
both known hosts and agent identities: previously these would iterate
over internal references but with this shift there isn't a reasonable
way to make that safe. The strategy is instead to return a copy of the
host/identity data and then later look up the associated raw pointer
when needed. The purist in me feels that the copy feels slightly
wasteful, but the realist justifies this with the observation that the
cardinality of both known hosts and identities is typically small enough
that the cost of this is in the noise compared to actually doing the
crypto+network ops.
I've removed a couple of error code related helpers from some of
the objects: those were really internal APIs and were redundant
with methods exported by the Error type anyway.
Fixes: https://github.com/alexcrichton/ssh2-rs/issues/154
Refs: https://github.com/alexcrichton/ssh2-rs/issues/137
Diffstat (limited to 'Cargo.toml')
-rw-r--r-- | Cargo.toml | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,6 +1,6 @@ [package] name = "ssh2" -version = "0.6.0" +version = "0.7.0" authors = ["Alex Crichton <alex@alexcrichton.com>", "Wez Furlong <wez@wezfurlong.org>"] license = "MIT/Apache-2.0" keywords = ["ssh"] @@ -20,6 +20,7 @@ vendored-openssl = ["libssh2-sys/vendored-openssl"] bitflags = "1.2" libc = "0.2" libssh2-sys = { path = "libssh2-sys", version = "0.2.13" } +parking_lot = "0.10" [dev-dependencies] tempdir = "0.3" |