+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(descriptor);
+ }
+
+ /**
+ * Disconnect a peer given its node id.
+ *
+ * Set `no_connection_possible` to true to prevent any further connection with this peer,
+ * force-closing any channels we have with it.
+ *
+ * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the
+ * peer. Thus, be very careful about reentrancy issues.
+ *
+ * [`disconnect_socket`]: SocketDescriptor::disconnect_socket
+ */
+ public void disconnect_by_node_id(byte[] node_id, boolean no_connection_possible) {
+ bindings.PeerManager_disconnect_by_node_id(this.ptr, InternalUtils.check_arr_len(node_id, 33), no_connection_possible);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(node_id);
+ Reference.reachabilityFence(no_connection_possible);
+ }
+
+ /**
+ * Disconnects all currently-connected peers. This is useful on platforms where there may be
+ * an indication that TCP sockets have stalled even if we weren't around to time them out
+ * using regular ping/pongs.
+ */
+ public void disconnect_all_peers() {
+ bindings.PeerManager_disconnect_all_peers(this.ptr);
+ Reference.reachabilityFence(this);