summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/local/main.c4
-rw-r--r--src/ipcpd/normal/main.c4
-rw-r--r--src/ipcpd/shim-eth-llc/main.c4
-rw-r--r--src/ipcpd/shim-udp/main.c4
-rw-r--r--src/irmd/main.c27
5 files changed, 22 insertions, 21 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 6993cea2..547e7e28 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -228,8 +228,8 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGHUP:
case SIGQUIT:
if (info->si_pid == irmd_api) {
- LOG_DBG("Terminating by order of %d. Bye.",
- info->si_pid);
+ LOG_DBG("IPCP %d terminating by order of %d. Bye.",
+ getpid(), info->si_pid);
pthread_rwlock_wrlock(&_ipcp->state_lock);
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index f0fc0681..335330ae 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -72,8 +72,8 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGTERM:
case SIGHUP:
if (info->si_pid == irmd_api) {
- LOG_DBG("Terminating by order of %d. Bye.",
- info->si_pid);
+ LOG_DBG("IPCP %d terminating by order of %d. Bye.",
+ getpid(), info->si_pid);
pthread_rwlock_wrlock(&_ipcp->state_lock);
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index 60b55009..608b0029 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -830,8 +830,8 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGTERM:
case SIGHUP:
if (info->si_pid == irmd_api) {
- LOG_DBG("Terminating by order of %d. Bye.",
- info->si_pid);
+ LOG_DBG("IPCP %d terminating by order of %d. Bye.",
+ getpid(), info->si_pid);
pthread_rwlock_wrlock(&_ipcp->state_lock);
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index 292d347d..3f9b20f1 100644
--- a/src/ipcpd/shim-udp/main.c
+++ b/src/ipcpd/shim-udp/main.c
@@ -793,8 +793,8 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
case SIGTERM:
case SIGHUP:
if (info->si_pid == irmd_api) {
- LOG_DBG("Terminating by order of %d. Bye.",
- info->si_pid);
+ LOG_DBG("IPCP %d terminating by order of %d. Bye.",
+ getpid(), info->si_pid);
pthread_rwlock_wrlock(&_ipcp->state_lock);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 5f793afd..cd939360 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1548,6 +1548,20 @@ static void irm_destroy()
if (irmd->threadpool != NULL)
free(irmd->threadpool);
+ pthread_rwlock_wrlock(&irmd->flows_lock);
+
+ list_for_each_safe(p, h, &irmd->irm_flows) {
+ struct irm_flow * f = list_entry(p, struct irm_flow, next);
+ list_del(&f->next);
+ ipcp_flow_dealloc(f->n_1_api, f->port_id);
+ irm_flow_destroy(f);
+ }
+
+ close(irmd->sockfd);
+
+ if (unlink(IRM_SOCK_PATH))
+ LOG_DBG("Failed to unlink %s.", IRM_SOCK_PATH);
+
pthread_rwlock_wrlock(&irmd->reg_lock);
/* clear the lists */
list_for_each_safe(p, h, &irmd->ipcps) {
@@ -1585,14 +1599,6 @@ static void irm_destroy()
pthread_rwlock_unlock(&irmd->reg_lock);
- pthread_rwlock_wrlock(&irmd->flows_lock);
-
- list_for_each_safe(p, h, &irmd->irm_flows) {
- struct irm_flow * f = list_entry(p, struct irm_flow, next);
- list_del(&f->next);
- irm_flow_destroy(f);
- }
-
if (irmd->port_ids != NULL)
bmp_destroy(irmd->port_ids);
@@ -1604,11 +1610,6 @@ static void irm_destroy()
if (irmd->lf != NULL)
lockfile_destroy(irmd->lf);
- close(irmd->sockfd);
-
- if (unlink(IRM_SOCK_PATH))
- LOG_DBG("Failed to unlink %s.", IRM_SOCK_PATH);
-
pthread_rwlock_unlock(&irmd->state_lock);
pthread_rwlock_destroy(&irmd->reg_lock);