summaryrefslogtreecommitdiff
path: root/rust/src/enterprise.rs
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-03-31 19:09:31 -0400
committerGlenn Smith <glenn@vector35.com>2025-04-01 15:42:16 -0400
commit8780656197347069737766274528650312981924 (patch)
tree2b6ad6537603b5d94999e5027c122eab6e3578d2 /rust/src/enterprise.rs
parent7d72d25998116ae4ebb8d911ee9dad31ffa60ea0 (diff)
Rust: Better support for floating licenses
Diffstat (limited to 'rust/src/enterprise.rs')
-rw-r--r--rust/src/enterprise.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/rust/src/enterprise.rs b/rust/src/enterprise.rs
index ad682aad..7030b194 100644
--- a/rust/src/enterprise.rs
+++ b/rust/src/enterprise.rs
@@ -20,10 +20,12 @@ pub enum EnterpriseCheckoutError {
}
/// Initialize the enterprise server connection to check out a floating license.
-pub fn checkout_license(duration: Duration) -> Result<(), EnterpriseCheckoutError> {
+/// Result value is if we actually checked out a license (i.e. Ok(false) means we already have a
+/// license checked out and will not need to release it later)
+pub fn checkout_license(duration: Duration) -> Result<bool, EnterpriseCheckoutError> {
if crate::is_ui_enabled() {
// We only need to check out a license if running headlessly.
- return Ok(());
+ return Ok(false);
}
// The disparate core functions we call here might already have mutexes to guard.
@@ -72,9 +74,10 @@ pub fn checkout_license(duration: Duration) -> Result<(), EnterpriseCheckoutErro
last_error,
));
}
+ Ok(true)
+ } else {
+ Ok(false)
}
-
- Ok(())
}
pub fn release_license() {