Skip to content

QuantumGate::Local::DisconnectFrom

Karel Donk edited this page Dec 10, 2019 · 8 revisions

Initiates disconnection from a peer on the network and either returns immediately (2 and 4) or blocks until the peer is disconnected or the attempt failed (1 and 3). The optional DisconnectCallback function gets called when the peer was disconnected (2 and 4).

Signature

  1. Result<> DisconnectFrom(const PeerLUID pluid) noexcept;
  2. Result<> DisconnectFrom(const PeerLUID pluid,
                            DisconnectCallback&& function) noexcept;
  3. Result<> DisconnectFrom(Peer& peer) noexcept;
  4. Result<> DisconnectFrom(Peer& peer,
                            DisconnectCallback&& function) noexcept;

Parameters

Name Description
pluid A QuantumGate::PeerLUID with the Locally Unique Identifier of the connected peer.
peer A QuantumGate::Peer representing the connected peer.
function A QuantumGate::DisconnectCallback object containing the function to call when the connection closes. See QuantumGate Callbacks for more details. This parameter can be nullptr.

Return values

Returns a QuantumGate::Result object equal to one of the following QuantumGate::ResultCodes:

Value Description
QuantumGate::ResultCode::Succeeded The operation succeeded.
QuantumGate::ResultCode::Failed The operation failed.
QuantumGate::ResultCode::PeerNotFound The operation failed because the peer wasn't found.
QuantumGate::ResultCode::NotRunning The operation failed because the instance isn't running.
Clone this wiki locally