Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call stop() on Node drop #84

Merged
merged 2 commits into from
May 10, 2023
Merged

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented May 2, 2023

Fixes #79

We simply call stop() on dropping the Node object to allow for a cleaner shutdown by default.

We also include a minor commit which changes the API to take SocketAddrs and PublicKeys by value as they'll be copied/dereferenced in most cases anyways and this makes the API a tiny bit more uniform.

tnull added 2 commits May 9, 2023 09:35
They are copied/defereneced in most cases anyways, and this makes the
interface a bit more uniform.
@tnull tnull force-pushed the 2023-05-stop-on-drop branch from feda4b4 to 7c067a7 Compare May 9, 2023 07:41
@tnull
Copy link
Collaborator Author

tnull commented May 9, 2023

Rebased after #25 has been merged.

@@ -1440,6 +1440,12 @@ impl Node {
}
}

impl Drop for Node {
fn drop(&mut self) {
let _ = self.stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the node is already stopped, this will return Error::NotRunning. I guess that is ok though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's why I'm ignoring the result here.

@tnull tnull merged commit 80d62d4 into lightningdevkit:main May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call Node::stop() on drop()
2 participants