summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/pol
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-10-12 17:01:39 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-10-12 17:35:11 +0200
commit3a650d07d2d7540ebee65cef58b35f0373ad14d6 (patch)
treeed4c42539f3fb25b0cf0177c211b91424e42513a /src/ipcpd/normal/pol
parentd375c023b5fa68e3a9804687683772c2734be8a4 (diff)
downloadouroboros-3a650d07d2d7540ebee65cef58b35f0373ad14d6.tar.gz
ouroboros-3a650d07d2d7540ebee65cef58b35f0373ad14d6.zip
ipcpd: Send link state message before lsdb update0.12.3
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@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/pol')
-rw-r--r--src/ipcpd/normal/pol/link_state.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c
index e8677f0d..5f592edf 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);