From 8780656197347069737766274528650312981924 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 31 Mar 2025 19:09:31 -0400 Subject: Rust: Better support for floating licenses --- rust/src/enterprise.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'rust/src/enterprise.rs') 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 { 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() { -- cgit v1.3.1