Skip to content

Commit

Permalink
Send SwitchProtocolVersion on ConnectionRefresh
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryDodzin committed Jan 28, 2025
1 parent 377fe96 commit 1e729b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mirrord/intproxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ impl IntProxy {

#[tracing::instrument(level = Level::TRACE, skip(self), err)]
async fn handle_connection_refresh(&self) -> Result<(), IntProxyError> {
self.task_txs
.simple
.send(SimpleProxyMessage::ConnectionRefresh)
.await;

self.task_txs
.incoming
.send(IncomingProxyMessage::ConnectionRefresh)
Expand Down
9 changes: 9 additions & 0 deletions mirrord/intproxy/src/proxies/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub enum SimpleProxyMessage {
GetEnvRes(RemoteResult<HashMap<String, String>>),
/// Protocol version was negotiated with the agent.
ProtocolVersion(Version),
/// Agent connection was refreshed need to negotiate version
ConnectionRefresh,
}

#[derive(Error, Debug)]
Expand Down Expand Up @@ -123,6 +125,13 @@ impl BackgroundTask for SimpleProxy {
.await
}
SimpleProxyMessage::ProtocolVersion(version) => self.set_protocol_version(version),
SimpleProxyMessage::ConnectionRefresh => {
if let Some(version) = &self.protocol_version {
message_bus
.send(ClientMessage::SwitchProtocolVersion(version.clone()))
.await
}
}
}
}

Expand Down

0 comments on commit 1e729b8

Please sign in to comment.