Skip to content

Commit

Permalink
fix(rust): fixed app reporting inlet as disconnected when it was ac…
Browse files Browse the repository at this point in the history
…tually connected
  • Loading branch information
davide-baldo committed Nov 17, 2023
1 parent 0b82836 commit 1821aad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ impl AppState {
match result {
Ok(port) => {
if let Some(service) = guard.find_mut_by_id(service.id()) {
service.set_port(port)
if let Some(port) = port {
service.set_port(port)
}
}
}
Err(err) => {
warn!(%err, "Failed to refresh TCP inlet for accepted invitation");
if let Some(service) = guard.find_mut_by_id(service.id()) {
service.set_port(None)
service.remove_port()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ impl IncomingService {
self.enabled
}

pub fn set_port(&mut self, port: Option<Port>) {
self.port = port;
pub fn set_port(&mut self, port: Port) {
self.port = Some(port);
}

pub fn remove_port(&mut self) {
self.port = None;
}

pub fn enable(&mut self) {
Expand Down

0 comments on commit 1821aad

Please sign in to comment.