diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-15 23:36:23 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-05-15 23:36:23 +0200 |
commit | 80a4808418694fcd9d96dc714a984e157c90a6ab (patch) | |
tree | b9290ca79684f7f5338c7fff44e31f9b395a65fe /src/ipcpd/shim-udp/main.c | |
parent | 3f5b31d49139968a84c42d5d3067d06edefa3aae (diff) | |
download | ouroboros-80a4808418694fcd9d96dc714a984e157c90a6ab.tar.gz ouroboros-80a4808418694fcd9d96dc714a984e157c90a6ab.zip |
fixed two unlocks, removed the thread_lock.
Diffstat (limited to 'src/ipcpd/shim-udp/main.c')
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 300a5748..e3f7fcdd 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -94,9 +94,6 @@ struct shim_ap_data { pthread_t sduloop; pthread_t handler; pthread_t sdu_reader; - - rw_lock_t thread_lock; - } * _ap_instance; static int shim_ap_init(char * ap_name) @@ -306,8 +303,6 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c) } if (clean_threads) { - rw_lock_wrlock(&_ap_instance->thread_lock); - pthread_cancel(_ap_instance->handler); pthread_cancel(_ap_instance->sdu_reader); pthread_cancel(_ap_instance->sduloop); @@ -315,8 +310,6 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c) pthread_join(_ap_instance->sduloop, NULL); pthread_join(_ap_instance->handler, NULL); pthread_join(_ap_instance->sdu_reader, NULL); - - rw_lock_unlock(&_ap_instance->thread_lock); } pthread_cancel(_ap_instance->mainloop); @@ -434,7 +427,7 @@ static void * ipcp_udp_sdu_reader() int n; int fd; char buf[SHIM_UDP_MAX_SDU_SIZE]; - struct timeval tv = {0, 750}; + struct timeval tv = {0, 100}; struct sockaddr_in r_saddr; fd_set read_fds; int flags; @@ -503,7 +496,7 @@ static void * ipcp_udp_sdu_loop(void * o) e = shm_ap_rbuff_read(_ap_instance->rb); if (e == NULL) { - rw_lock_rdlock(&_ipcp->state_lock); + rw_lock_unlock(&_ipcp->state_lock); continue; } @@ -511,7 +504,7 @@ static void * ipcp_udp_sdu_loop(void * o) _ap_instance->dum, e->index); if (len == -1) { - rw_lock_rdlock(&_ipcp->state_lock); + rw_lock_unlock(&_ipcp->state_lock); free(e); continue; } @@ -911,7 +904,6 @@ static int ipcp_udp_flow_alloc(int port_id, uint32_t dns_addr = 0; #endif struct shm_ap_rbuff * rb; - struct timespec wait = {0, 1000000}; if (dst_name == NULL || src_ap_name == NULL || src_ae_name == NULL) return -1; @@ -1035,8 +1027,6 @@ static int ipcp_udp_flow_alloc(int port_id, FD_SET(fd, &shim_data(_ipcp)->flow_fd_s); - nanosleep(&wait, NULL); - rw_lock_unlock(&_ap_instance->flows_lock); /* tell IRMd that flow allocation "worked" */ |