diff options
| author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-09-21 15:05:13 +0000 | 
|---|---|---|
| committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-21 15:05:13 +0000 | 
| commit | 6ef3b4767b60c9fd7482bf4aa9b9271131e24053 (patch) | |
| tree | 576c10d7c990add69888c9b812b212637c7f6f39 /src/ipcpd/local | |
| parent | e2d3b18ab787ebe090cd958cc63be655be86f42c (diff) | |
| parent | 74364d19237e80081d1c6a76b46d787527638fcb (diff) | |
| download | ouroboros-6ef3b4767b60c9fd7482bf4aa9b9271131e24053.tar.gz ouroboros-6ef3b4767b60c9fd7482bf4aa9b9271131e24053.zip | |
Merged in dstaesse/ouroboros/be-cancel (pull request #609)
ipcpd: Cancel threads in IPCPs
Diffstat (limited to 'src/ipcpd/local')
| -rw-r--r-- | src/ipcpd/local/main.c | 18 | 
1 files changed, 9 insertions, 9 deletions
| diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 7f44a2c6..b98e144c 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -44,8 +44,8 @@  #include <sys/wait.h>  #include <assert.h> -#define EVENT_WAIT_TIMEOUT 100 /* us */ -#define THIS_TYPE IPCP_LOCAL +#define THIS_TYPE     IPCP_LOCAL +#define ALLOC_TIMEOUT 10 /* ms */  struct {          struct shim_data * shim_data; @@ -95,15 +95,13 @@ static void local_data_fini(void){  static void * ipcp_local_sdu_loop(void * o)  { -        struct timespec timeout = {0, EVENT_WAIT_TIMEOUT * 1000}; -          (void) o; -        while (ipcp_get_state() == IPCP_OPERATIONAL) { +        while (true) {                  int     fd;                  ssize_t idx; -                fevent(local_data.flows, local_data.fq, &timeout); +                fevent(local_data.flows, local_data.fq, NULL);                  while ((fd = fqueue_next(local_data.fq)) >= 0) {                          idx = local_flow_read(fd); @@ -181,7 +179,7 @@ static int ipcp_local_flow_alloc(int             fd,                                   const uint8_t * dst,                                   qoscube_t       cube)  { -        struct timespec ts     = {0, EVENT_WAIT_TIMEOUT * 1000}; +        struct timespec ts     = {0, ALLOC_TIMEOUT * MILLION};          struct timespec abstime;          int             out_fd = -1; @@ -237,7 +235,7 @@ static int ipcp_local_flow_alloc(int             fd,  static int ipcp_local_flow_alloc_resp(int fd,                                        int response)  { -        struct timespec ts     = {0, EVENT_WAIT_TIMEOUT * 1000}; +        struct timespec ts     = {0, ALLOC_TIMEOUT * MILLION};          struct timespec abstime;          int             out_fd = -1;          int             ret    = -1; @@ -359,8 +357,10 @@ int main(int    argc,          ipcp_shutdown(); -        if (ipcp_get_state() == IPCP_SHUTDOWN) +        if (ipcp_get_state() == IPCP_SHUTDOWN) { +                pthread_cancel(local_data.sduloop);                  pthread_join(local_data.sduloop, NULL); +        }          local_data_fini(); | 
