summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-eth-llc
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-29 15:52:53 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-29 15:52:53 +0000
commit2fc3f5a58d0c161550050747dd18f96f0f96c694 (patch)
tree6f32f64e759434e60bbb6a7d46b8a3ce2ae8768e /src/ipcpd/shim-eth-llc
parentf7942245a37c591d3c3b8d6526dcc38dcf255d25 (diff)
parent407f1e70cedcf8d7694a5fefa5faf3225abebc81 (diff)
downloadouroboros-2fc3f5a58d0c161550050747dd18f96f0f96c694.tar.gz
ouroboros-2fc3f5a58d0c161550050747dd18f96f0f96c694.zip
Merged in sandervrijders/ouroboros/be-dir-query (pull request #576)
shim-eth-llc: Hide directory query locking
Diffstat (limited to 'src/ipcpd/shim-eth-llc')
-rw-r--r--src/ipcpd/shim-eth-llc/main.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index be1e6423..292ecbe7 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -512,24 +512,13 @@ static int eth_llc_ipcp_name_query_req(const uint8_t * hash,
static int eth_llc_ipcp_name_query_reply(const uint8_t * hash,
uint8_t * r_addr)
{
- uint64_t address = 0;
- struct list_head * pos;
+ uint64_t address = 0;
memcpy(&address, r_addr, MAC_SIZE);
shim_data_dir_add_entry(eth_llc_data.shim_data, hash, address);
- pthread_mutex_lock(&eth_llc_data.shim_data->dir_queries_lock);
-
- list_for_each(pos, &eth_llc_data.shim_data->dir_queries) {
- struct dir_query * e =
- list_entry(pos, struct dir_query, next);
- if (memcmp(e->hash, hash, ipcp_dir_hash_len()) == 0) {
- shim_data_dir_query_respond(e);
- }
- }
-
- pthread_mutex_unlock(&eth_llc_data.shim_data->dir_queries_lock);
+ shim_data_dir_query_respond(eth_llc_data.shim_data, hash);
return 0;
}
@@ -1050,22 +1039,15 @@ static int eth_llc_ipcp_query(const uint8_t * hash)
memset(r_addr, 0xff, MAC_SIZE);
- query = shim_data_dir_query_create(hash);
+ query = shim_data_dir_query_create(eth_llc_data.shim_data, hash);
if (query == NULL)
return -1;
- pthread_mutex_lock(&eth_llc_data.shim_data->dir_queries_lock);
- list_add(&query->next, &eth_llc_data.shim_data->dir_queries);
- pthread_mutex_unlock(&eth_llc_data.shim_data->dir_queries_lock);
-
eth_llc_ipcp_send_mgmt_frame(&msg, r_addr);
ret = shim_data_dir_query_wait(query, &timeout);
- pthread_mutex_lock(&eth_llc_data.shim_data->dir_queries_lock);
- list_del(&query->next);
- shim_data_dir_query_destroy(query);
- pthread_mutex_unlock(&eth_llc_data.shim_data->dir_queries_lock);
+ shim_data_dir_query_destroy(eth_llc_data.shim_data, query);
return ret;
}