From 9c8ae2d28f0c3e75371fbae6e9f688798b44255c Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Thu, 23 May 2024 00:42:25 +0200 Subject: added multiple server receiver threads; added server dir query --- ecp/server/dir.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'ecp/server/dir.c') diff --git a/ecp/server/dir.c b/ecp/server/dir.c index 95db4b5..c045599 100644 --- a/ecp/server/dir.c +++ b/ecp/server/dir.c @@ -428,7 +428,7 @@ void dir_process_item(ECPDirItem *dir_item, ECPSocket *sock, ecp_ecdh_public_t * pthread_mutex_lock(&node->mutex); pthread_rwlock_unlock(&dir_shadow_rwlock); - if (node->zombie) goto process_item_fin; + if (node->zombie || (s_public == NULL)) goto process_item_fin; if (!node->verified) { int key_ex = 0; @@ -754,6 +754,19 @@ void dit_init_serial(uint16_t serial) { } } +int dir_init_dir_cnt(unsigned int dir_cnt, uint16_t serial) { + int rv = ECP_OK; + + if (dir_online) { + pthread_rwlock_wrlock(&dir_online_rwlock); + if (dir_online->serial != serial) rv = ECP_ERR; + if (!rv) dir_vkey_req = dir_cnt / 2 + 1; + pthread_rwlock_unlock(&dir_online_rwlock); + } + + return rv; +} + void dir_announce(ECPSocket *sock, int ann_period) { struct hashtable_itr itr; DIRNode *node; -- cgit v1.2.3