summaryrefslogtreecommitdiff
path: root/rust/src/collaboration
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-01-27 16:56:15 -0500
committerMason Reed <mason@vector35.com>2025-01-27 17:52:29 -0500
commit01a224425d2a90e660bbfffe8d1cbc6b93da24bd (patch)
tree4be2aa6c3154b4fb34e61815956dcd357c754e2c /rust/src/collaboration
parent9c9f5085e010059c813d2285ddff79b542c76834 (diff)
Fix some rust race conditions and comment some likely suspects
FYI The binary view saving stuff can deadlock right now, so we document that now :/
Diffstat (limited to 'rust/src/collaboration')
-rw-r--r--rust/src/collaboration/remote.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/src/collaboration/remote.rs b/rust/src/collaboration/remote.rs
index 382d1ca2..21f148e9 100644
--- a/rust/src/collaboration/remote.rs
+++ b/rust/src/collaboration/remote.rs
@@ -192,6 +192,10 @@ impl Remote {
/// Connects to the Remote, loading metadata and optionally acquiring a token.
///
/// Use [Remote::connect_with_opts] if you cannot otherwise automatically connect using enterprise.
+ ///
+ /// WARNING: This is currently **not** thread safe, if you try and connect/disconnect to a remote on
+ /// multiple threads you will be subject to race conditions. To avoid this wrap the [`Remote`] in
+ /// a synchronization primitive, and pass that to your threads. Or don't try and connect on multiple threads.
pub fn connect(&self) -> Result<(), ()> {
// TODO: implement SecretsProvider
if self.is_enterprise()? && enterprise::is_server_authenticated() {
@@ -234,6 +238,10 @@ impl Remote {
}
/// Disconnects from the remote.
+ ///
+ /// WARNING: This is currently **not** thread safe, if you try and connect/disconnect to a remote on
+ /// multiple threads you will be subject to race conditions. To avoid this wrap the [`Remote`] in
+ /// a synchronization primitive, and pass that to your threads. Or don't try and connect on multiple threads.
pub fn disconnect(&self) -> Result<(), ()> {
let success = unsafe { BNRemoteDisconnect(self.handle.as_ptr()) };
success.then_some(()).ok_or(())