diff options
author | Sander Vrijders <[email protected]> | 2016-08-31 20:47:23 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-08-31 20:47:23 +0200 |
commit | 28fe806163bfabd08dcfbe5de7bd84431453c9de (patch) | |
tree | f15f6f31b72d92085dba179a85e4f3972fc9735d /src | |
parent | 2c47c4f24b314a87e528153486eab9d5a9cd5abc (diff) | |
parent | 98d0ecf6deecf25ad48c55b2d714b2cdacdd48cb (diff) | |
download | ouroboros-28fe806163bfabd08dcfbe5de7bd84431453c9de.tar.gz ouroboros-28fe806163bfabd08dcfbe5de7bd84431453c9de.zip |
Merged in dstaesse/ouroboros/be-bugfixing (pull request #232)
irmd: Fix binding after registering
Diffstat (limited to 'src')
-rw-r--r-- | src/irmd/main.c | 5 | ||||
-rw-r--r-- | src/lib/shm_rdrbuff.c | 30 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c index 29f6d9d0..465415b8 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -482,6 +482,7 @@ static int bind_ap(char * ap, int i; char * name_dup = NULL; struct apn_entry * e = NULL; + struct reg_entry * re = NULL; if (ap == NULL || name == NULL) return -EINVAL; @@ -561,6 +562,10 @@ static int bind_ap(char * ap, return -ENOMEM; } + re = registry_get_entry(&irmd->registry, name); + if (re != NULL && reg_entry_add_apn(re, e) < 0) + LOG_ERR("Failed adding AP %s for name %s.", ap, name); + pthread_rwlock_unlock(&irmd->reg_lock); pthread_rwlock_unlock(&irmd->state_lock); diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c index 87fe2d97..0587a8b9 100644 --- a/src/lib/shm_rdrbuff.c +++ b/src/lib/shm_rdrbuff.c @@ -70,7 +70,7 @@ struct shm_du_buff { size_t size; -#ifdef SHM_DU_MAP_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK size_t blocks; #endif size_t du_head; @@ -93,7 +93,7 @@ struct shm_rdrbuff { static void garbage_collect(struct shm_rdrbuff * rdrb) { -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK struct shm_du_buff * sdb; while (!shm_rdrb_empty(rdrb) && (sdb = get_tail_ptr(rdrb))->dst_api == -1) @@ -116,7 +116,7 @@ static void clean_sdus(struct shm_rdrbuff * rdrb, pid_t api) buf = idx_to_du_buff_ptr(rdrb, idx); if (buf->dst_api == api) buf->dst_api = -1; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK idx = (idx + buf->blocks) & (SHM_BUFFER_SIZE - 1); #else idx = (idx + 1) & (SHM_BUFFER_SIZE - 1); @@ -450,7 +450,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, { struct shm_du_buff * sdb; size_t size = headspace + len + tailspace; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK long blocks = 0; long padblocks = 0; #endif @@ -463,7 +463,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, return -1; } -#ifndef SHM_RDRBUFF_MULTI_BLOCK +#ifndef SHM_RDRB_MULTI_BLOCK if (sz > SHM_RDRB_BLOCK_SIZE) { LOG_DBGF("Multi-block SDU's disabled. Dropping."); return -1; @@ -477,7 +477,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, pthread_mutex_consistent(rdrb->lock); } #endif -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK while (sz > 0) { sz -= SHM_RDRB_BLOCK_SIZE; ++blocks; @@ -495,7 +495,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, return -1; } -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK if (padblocks) { sdb = get_head_ptr(rdrb); sdb->size = 0; @@ -512,7 +512,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, sdb->dst_api = dst_api; sdb->du_head = headspace; sdb->du_tail = sdb->du_head + len; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK sdb->blocks = blocks; #endif write_pos = ((uint8_t *) (sdb + 1)) + headspace; @@ -520,7 +520,7 @@ ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb, memcpy(write_pos, data, len); idx = *rdrb->ptr_head; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK *rdrb->ptr_head = (*rdrb->ptr_head + blocks) & (SHM_BUFFER_SIZE - 1); #else *rdrb->ptr_head = (*rdrb->ptr_head + 1) & (SHM_BUFFER_SIZE - 1); @@ -539,7 +539,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, { struct shm_du_buff * sdb; size_t size = headspace + len + tailspace; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK long blocks = 0; long padblocks = 0; #endif @@ -552,7 +552,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, return -1; } -#ifndef SHM_RDRBUFF_MULTI_BLOCK +#ifndef SHM_RDRB_MULTI_BLOCK if (sz > SHM_RDRB_BLOCK_SIZE) { LOG_DBGF("Multi-block SDU's disabled. Dropping."); return -1; @@ -569,7 +569,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, pthread_cleanup_push((void(*)(void *))pthread_mutex_unlock, (void *) rdrb->lock); -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK while (sz > 0) { sz -= SHM_RDRB_BLOCK_SIZE; ++blocks; @@ -586,7 +586,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, pthread_cond_wait(rdrb->healthy, rdrb->lock); } -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK if (padblocks) { sdb = get_head_ptr(rdrb); sdb->size = 0; @@ -603,7 +603,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, sdb->dst_api = dst_api; sdb->du_head = headspace; sdb->du_tail = sdb->du_head + len; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK sdb->blocks = blocks; #endif write_pos = ((uint8_t *) (sdb + 1)) + headspace; @@ -611,7 +611,7 @@ ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb, memcpy(write_pos, data, len); idx = *rdrb->ptr_head; -#ifdef SHM_RDRBUFF_MULTI_BLOCK +#ifdef SHM_RDRB_MULTI_BLOCK *rdrb->ptr_head = (*rdrb->ptr_head + blocks) & (SHM_BUFFER_SIZE - 1); #else *rdrb->ptr_head = (*rdrb->ptr_head + 1) & (SHM_BUFFER_SIZE - 1); |