Skip to content

Struggling with server shutdown #493

Answered by dwrensha
JonasVautherin asked this question in Q&A
Discussion options

You must be logged in to vote

When the client and server are in separate processes, the client process terminates and closes the connection, causing the server process to also shut down. When they are in the same process, you need to trigger the disconnect yourself. You can do so using the RpcSystem::get_connector() method:

/// Returns a `Disconnector` future that can be run to cleanly close the connection to this `RpcSystem`'s network.
/// You should get the `Disconnector` before you spawn the `RpcSystem`.
pub fn get_disconnector(&self) -> rpc::Disconnector<VatId> {
rpc::Disconnector::new(self.connection_state.clone())
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@JonasVautherin
Comment options

@dwrensha
Comment options

@JonasVautherin
Comment options

Answer selected by JonasVautherin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants