Skip to content

Commit

Permalink
Incoming fixed in layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Razz4780 committed Oct 2, 2023
1 parent 0dfb55b commit 3fd9acc
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 877 deletions.
16 changes: 16 additions & 0 deletions mirrord/intproxy/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ impl<T, W> SyncSender<T, W> {
_phantom: Default::default(),
}
}

pub fn into_inner(self) -> W {
self.writer
}
}

impl<T, W> SyncSender<T, W>
Expand Down Expand Up @@ -80,6 +84,10 @@ impl<T, R> SyncReceiver<T, R> {
_phantom: Default::default(),
}
}

pub fn into_inner(self) -> R {
self.reader
}
}

impl<T, R> SyncReceiver<T, R>
Expand Down Expand Up @@ -134,6 +142,10 @@ impl<T, W> AsyncSender<T, W> {
_phantom: Default::default(),
}
}

pub fn into_inner(self) -> W {
self.writer
}
}

impl<T, W> AsyncSender<T, W>
Expand Down Expand Up @@ -169,6 +181,10 @@ impl<T, R> AsyncReceiver<T, R> {
_phantom: Default::default(),
}
}

pub fn into_inner(self) -> R {
self.reader
}
}

impl<T, R> AsyncReceiver<T, R>
Expand Down
16 changes: 8 additions & 8 deletions mirrord/intproxy/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub enum IncomingRequest {
#[derive(Encode, Decode, Debug)]
pub struct PortSubscribe {
pub port: Port,
pub listening_on: SocketAddress,
}

#[derive(Encode, Decode, Debug)]
Expand All @@ -118,12 +119,9 @@ pub enum ProxyToLayerMessage {
/// A response to layer's [`OutgoingConnectRequest`]
OutgoingConnect(RemoteResult<OutgoingConnectResponse>),
/// A response to layer's [`PortSubscribe`]
Incoming(PortSubscribeResult),
}

#[derive(Encode, Decode, Debug)]
pub struct PortSubscribeResult {
result: RemoteResult<()>,
IncomingSubscribe(RemoteResult<()>),
/// A response to layer's [`PortUnsubscribe`]
IncomingUbsubscribe(RemoteResult<()>),
}

/// A response to layer's [`OutgoingConnectRequest`].
Expand Down Expand Up @@ -387,14 +385,16 @@ impl_request!(

impl_request!(
req = PortSubscribe,
res = PortSubscribeResult,
res = RemoteResult<()>,
req_path = LayerToProxyMessage::Incoming => IncomingRequest::PortSubscribe,
res_path = ProxyToLayerMessage::Incoming,
res_path = ProxyToLayerMessage::IncomingSubscribe,
);

impl_request!(
req = PortUnsubscribe,
res = RemoteResult<()>,
req_path = LayerToProxyMessage::Incoming => IncomingRequest::PortUnsubscribe,
res_path = ProxyToLayerMessage::IncomingUbsubscribe,
);

#[test]
Expand Down
2 changes: 1 addition & 1 deletion mirrord/layer/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub(crate) enum HookError {
#[error("mirrord-layer: Ignored file")]
FileNotFound,

#[error("mirrord-layer: Proxy connection failed with `{0}`")]
#[error("mirrord-layer: Proxy connection failed: `{0}`")]
ProxyError(#[from] ProxyError),
}

Expand Down
66 changes: 0 additions & 66 deletions mirrord/layer/src/incoming/mirror.rs

This file was deleted.

22 changes: 0 additions & 22 deletions mirrord/layer/src/incoming/mod.rs

This file was deleted.

Loading

0 comments on commit 3fd9acc

Please sign in to comment.