Skip to content

Commit

Permalink
feat(rust): adss smoltcp support and abstract tcp transport to tcp_core
Browse files Browse the repository at this point in the history
* All necessary changes to support using smoltcp as transport protocol in crate `ockam_transport_smoltcp`.
  * Includes async interface.
  * Ability to manually poll.
  * Necessary implementation of interfaces to run in std using tun/tap interface.

* Extract common behavior from smoltcp and std tcp into `ockam_transport_core` in a new `tcp` module.
  * Necessary unix socket behavior extracted into traits.
  * Worker and Route behavior extracted into common modules.
  * No support for portals and inlet yet.
  • Loading branch information
conectado committed Feb 19, 2022
1 parent 2a0d5d4 commit f36d0f0
Show file tree
Hide file tree
Showing 40 changed files with 6,091 additions and 443 deletions.
305 changes: 225 additions & 80 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions implementations/rust/ockam/ockam_core/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,24 @@ pub mod sync {
pub use spin::RwLock;

/// spin::Mutex.lock() does not return Option<T>
pub struct Mutex<T>(spin::Mutex<T>);
pub struct Mutex<T: ?Sized>(spin::Mutex<T>);
impl<T> Mutex<T> {
pub fn new(value: T) -> Self {
Mutex(spin::Mutex::new(value))
}
}
impl<T: ?Sized> Mutex<T> {
pub fn lock(&self) -> Option<spin::MutexGuard<'_, T>> {
Some(self.0.lock())
}
}
impl<T> core::ops::Deref for Mutex<T> {
impl<T: ?Sized> core::ops::Deref for Mutex<T> {
type Target = spin::Mutex<T>;
fn deref(&self) -> &spin::Mutex<T> {
&self.0
}
}
impl<T> core::ops::DerefMut for Mutex<T> {
impl<T: ?Sized> core::ops::DerefMut for Mutex<T> {
fn deref_mut(&mut self) -> &mut spin::Mutex<T> {
&mut self.0
}
Expand Down
Loading

0 comments on commit f36d0f0

Please sign in to comment.