From cc466db6973fe084aff139f147b08d583d8586a6 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 6 Aug 2021 17:40:09 +0000 Subject: [PATCH] Add a simple wrapper for `disconnect_by_node_id` in `NioPeerHandler` Fixes #36. --- src/main/java/org/ldk/batteries/NioPeerHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/org/ldk/batteries/NioPeerHandler.java b/src/main/java/org/ldk/batteries/NioPeerHandler.java index eac4d805..991a6b13 100644 --- a/src/main/java/org/ldk/batteries/NioPeerHandler.java +++ b/src/main/java/org/ldk/batteries/NioPeerHandler.java @@ -236,6 +236,15 @@ public class NioPeerHandler { } } + /** + * Disconnects any connections currently open with the peer with the given node id. + * + * @param their_node_id must be a valid 33-byte public key + */ + public void disconnect(byte[] their_node_id) { + this.peer_manager.disconnect_by_node_id(their_node_id, false); + } + /** * Binds a listening socket to the given address, accepting incoming connections and handling them on the background * thread. -- 2.39.5