From 1f7d02ca0ef4c65236190ccda34d804977c43d1d Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Fri, 17 Jan 2020 23:50:36 +0100
Subject: [PATCH] [fix] core: revert regression introduce by commit 1fc6292c

---
 lib/core/core/src/router.rs | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/lib/core/core/src/router.rs b/lib/core/core/src/router.rs
index b0db2b28..1baf6ad2 100644
--- a/lib/core/core/src/router.rs
+++ b/lib/core/core/src/router.rs
@@ -215,24 +215,18 @@ fn start_broadcasting_thread(
                 RecvTimeoutError::Disconnected => fatal_error!("router thread disconnnected !"),
             },
         }
-        if let Some(expected_regs_count) = expected_registrations_count {
-            if registrations_count < expected_regs_count
-                && SystemTime::now()
-                    .duration_since(start_time)
-                    .expect("Duration error !")
-                    .as_secs()
-                    > *MAX_REGISTRATION_DELAY
-            {
-                fatal_error!(
-                    "{} modules have registered, but expected {} !",
-                    registrations_count,
-                    expected_regs_count
-                );
-            }
-        } else {
+        if (expected_registrations_count.is_none()
+            || registrations_count < unwrap::unwrap!(expected_registrations_count))
+            && SystemTime::now()
+                .duration_since(start_time)
+                .expect("Duration error !")
+                .as_secs()
+                > *MAX_REGISTRATION_DELAY
+        {
             fatal_error!(
-                "{} modules have registered, but none expected !",
-                registrations_count
+                "{} modules have registered, but expected {} !",
+                registrations_count,
+                expected_registrations_count.unwrap_or(0)
             );
         }
     }
-- 
GitLab