pub struct RelayConnectionHandle {
pub relay_id: KeyId,
pub relay_address: RelayAddress,
result_receiver: Option<Receiver<Result<()>>>,
_task_handle: JoinHandle<()>,
}Expand description
Handle for a background relay connection attempt
This handle allows you to optionally poll the connection result, but the connection attempt continues in the background regardless of whether you poll it or not. The relay status will be updated via the normal status broadcast channels.
Fields§
§relay_id: KeyIdThe relay ID being connected to
relay_address: RelayAddressThe relay address being connected to
result_receiver: Option<Receiver<Result<()>>>Optional receiver for the final connection result If you don’t need the result, you can ignore this
_task_handle: JoinHandle<()>Background task handle - kept to prevent the task from being dropped
Implementations§
Source§impl RelayConnectionHandle
impl RelayConnectionHandle
Sourcepub fn try_result(&mut self) -> Result<Option<Result<()>>>
pub fn try_result(&mut self) -> Result<Option<Result<()>>>
Poll for the connection result (non-blocking)
Returns:
Ok(Some(result))if the connection attempt has completedOk(None)if the connection is still in progressErr(_)if there was an error polling (shouldn’t happen normally)
Sourcepub async fn await_result(self) -> Result<()>
pub async fn await_result(self) -> Result<()>
Wait for the connection result (blocking)
This consumes the handle and waits for the background task to complete. If you don’t call this, the connection will still complete in the background.