Skip to content

Commit 28931c0

Browse files
committed
Close the session on the remote server when the session object is destroyed.
1 parent e9a8e84 commit 28931c0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/client/remote.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,3 +1135,13 @@ impl<'a> Session<'a> for RpcSession {
11351135
}
11361136
}
11371137
}
1138+
1139+
impl Drop for RpcSession {
1140+
fn drop(&mut self) {
1141+
if let Some(session_id) = self.session_id {
1142+
self.close().unwrap_or_else(|err| {
1143+
eprint!("error closing the session {}, reason {}", session_id, err)
1144+
});
1145+
}
1146+
}
1147+
}

0 commit comments

Comments
 (0)