Age | Commit message (Collapse) | Author |
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This commit exposes the `shutdown` method of `Sft` and `close` method of
`File` to free resources. Previously this was done synchronously and
therefor not usable in async wrappers.
Whith the methods exposed they can be polled until success. If
successful a flag is set to notify the destructor that no resources
need to be freed anymore.
However, if resources were not cleaned up by calling `close` or
`shutdown` the destructor will clean up synchronously.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Refs: https://github.com/alexcrichton/ssh2-rs/issues/137
|
|
This fixes the CI build with nightly, as we have deny(warnings)
enabled.
|
|
Instead the internal session is kept alive via Rc
Refs: https://github.com/alexcrichton/ssh2-rs/issues/53
|
|
No functional changes, just formatting
|
|
Also removes the reexported flags from the crate root, since they're now
assoc. consts and it would be a bit weird to reexport those.
(breaking change)
|
|
|
|
|
|
Copy might constrain the implementation, but these are useful and shouldn't cause any difficulty in the future.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Closes #11
|
|
|
|
|
|
|
|
|
|
Lots of changes, but largely cosmetic, reorganization, or internal refactorings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|