When a new link is added, the link state update will be sent before
the database update, so the network is a little bit more quickly
aware. This improves odds of the DHT successfully enrolling at its
first attempt, reducing bootstrap time of a network.
Signed-off-by: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
---
CMakeLists.txt | 2 +-
src/ipcpd/normal/pol/link_state.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index badfd4b..7a5d967 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ include(GNUInstallDirs)
set(PACKAGE_VERSION_MAJOR 0)
set(PACKAGE_VERSION_MINOR 12)
-set(PACKAGE_VERSION_PATCH 2)
+set(PACKAGE_VERSION_PATCH 3)
set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(PACKAGE_DESCRIPTION "The Ouroboros prototype")
diff --git a/src/ipcpd/normal/pol/link_state.c
b/src/ipcpd/normal/pol/link_state.c
index e8677f0..5f592ed 100644
--- a/src/ipcpd/normal/pol/link_state.c
+++ b/src/ipcpd/normal/pol/link_state.c
@@ -789,16 +789,15 @@ static void handle_event(void * self,
switch (event) {
case NOTIFY_DT_CONN_ADD:
+ pthread_rwlock_rdlock(&ls.db_lock);
+ send_lsm(ipcpi.dt_addr, c->conn_info.addr, 0);
+ pthread_rwlock_unlock(&ls.db_lock);
+
if (lsdb_add_nb(c->conn_info.addr, c->flow_info.fd, NB_DT))
log_dbg("Failed to add neighbor to LSDB.");
if (lsdb_add_link(ipcpi.dt_addr, c->conn_info.addr, 0, &qs))
log_dbg("Failed to add new adjacency to LSDB.");
-
- pthread_rwlock_rdlock(&ls.db_lock);
- send_lsm(ipcpi.dt_addr, c->conn_info.addr, 0);
- pthread_rwlock_unlock(&ls.db_lock);
-
break;
case NOTIFY_DT_CONN_DEL:
flow_event(c->flow_info.fd, false);
--
2.19.1