keep quiche version check out of if (debug enabled) branch

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-09-13 11:23:52 +02:00 committed by Simone Bordet
parent 280bb4c887
commit 3d8433b58c
1 changed files with 5 additions and 4 deletions

View File

@ -55,13 +55,14 @@ public interface LibQuiche extends Library
public static void enable() public static void enable()
{ {
String quicheVersion = Holder.instance().quiche_version();
if (!EXPECTED_QUICHE_VERSION.equals(quicheVersion))
throw new IllegalStateException("Native Quiche library version [" + quicheVersion + "] does not match expected version [" + EXPECTED_QUICHE_VERSION + "]");
if (LIB_QUICHE_LOG.isDebugEnabled() && LOGGING_ENABLED.compareAndSet(false, true)) if (LIB_QUICHE_LOG.isDebugEnabled() && LOGGING_ENABLED.compareAndSet(false, true))
{ {
Holder.instance().quiche_enable_debug_logging(LIB_QUICHE_LOGGING_CALLBACK, null); Holder.instance().quiche_enable_debug_logging(LIB_QUICHE_LOGGING_CALLBACK, null);
String quicheVersion = Holder.instance().quiche_version(); LIB_QUICHE_LOG.debug("Quiche version {}", quicheVersion);
if (!EXPECTED_QUICHE_VERSION.equals(quicheVersion))
throw new IllegalStateException("Native Quiche library version [" + quicheVersion + "] does not match expected version [" + EXPECTED_QUICHE_VERSION + "]");
Logging.LIB_QUICHE_LOG.debug("Quiche version {}", quicheVersion);
} }
} }
} }