-
Notifications
You must be signed in to change notification settings - Fork 23
QuantumGate::Local::ConnectTo
Initiates a connection to a peer on the network and either returns immediately (1) or blocks until the connection has been made or the attempt failed (2). When the connection is established, or when it fails, the ConnectCallback
function gets called if one was supplied (1). If there was an existing connection to that peer, that connection is re-used.
-
Result<std::pair<PeerLUID, bool>> ConnectTo(ConnectParameters&& params, ConnectCallback&& function) noexcept;
-
Result<Peer> ConnectTo(ConnectParameters&& params) noexcept;
Name | Description |
---|---|
params |
A QuantumGate::ConnectParameters object containing the connection parameters. |
function |
A QuantumGate::ConnectCallback object containing the function to call when the connection was successful or unsuccessful. This function doesn't get called when an existing connection is re-used. See QuantumGate Callbacks for more details. This parameter can be nullptr . |
-
Returns a
QuantumGate::Result
containing, upon successful completion, astd::pair
with aQuantumGate::PeerLUID
and abool
. TheQuantumGate::PeerLUID
contains the Locally Unique Identifier of the peer upon successful initiation of the connection. Thebool
value indicates whether an existing connection was reused (true
if so). Note that it's possible in the case of a reused connection that the connection is still in the process of being fully established. -
Returns a
QuantumGate::Result
containing, upon successful completion, aQuantumGate::Peer
object representing the connected peer.
The QuantumGate::Result
object will equal one of the following QuantumGate::ResultCode
s:
Value | Description |
---|---|
QuantumGate::ResultCode::Succeeded |
The operation succeeded. |
QuantumGate::ResultCode::Failed |
The operation failed. |
QuantumGate::ResultCode::FailedRetry |
The operation failed but a retry can be successful. |
QuantumGate::ResultCode::NotRunning |
The operation failed because the instance isn't running. |
QuantumGate::ResultCode::NotAllowed |
The operation failed because a connection to the specified endpoint is not allowed by the configured security and access settings. |
QuantumGate::ResultCode::NoPeersForRelay |
The operation failed because there were no connected peers through which to establish a relayed connection. |