network object
This method will disconnect a connected peer once all previously queued packets have been sent out, giving them a guaranteed notification in the end.
bool disconnect_peer_softly(uint peer_id)
Parameters:
peer_id
The unique ID of the peer to disconnect.
Return value:
true on success, false on failure.
Remarks:
This function will send out a disconnection request, after first having taken the time to send any packets that may previously have been queued. This means that the disconnection may happen some time in the future and that other packets may be received by the remote peer before the disconnection notification, although this notification is still guaranteed to arrive in the end.
When this function returns, the disconnection is not yet complete. Only when an event of type disconnect that contains the peer ID in question has been received, is the disconnection successful.
Example:
See the main network chapter.