+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Send pings to each peer and disconnect those which did not respond to the last round of
+ * pings.
+ *
+ * This may be called on any timescale you want, however, roughly once every five to ten
+ * seconds is preferred. The call rate determines both how often we send a ping to our peers
+ * and how much time they have to respond before we disconnect them.
+ *
+ * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
+ * issues!
+ *
+ * [`send_data`]: SocketDescriptor::send_data
+ */
+ public void timer_tick_occurred() {
+ bindings.PeerManager_timer_tick_occurred(this.ptr);