summaryrefslogtreecommitdiffstats
path: root/PICA_node.c
diff options
context:
space:
mode:
authorAnton <anton@picapica>2019-03-13 20:52:51 +0400
committerAnton <anton@picapica>2019-03-13 20:52:51 +0400
commitf38e00a4fe396f8a367266a2ace77f5a75d7184a (patch)
treeaeda6dec7d33e57d2cc2506e7985fbcbc0113e6f /PICA_node.c
parent9ef382841dda8c20b5ad1d6be3ab965da6ce2c2f (diff)
downloadpica-pica-f38e00a4fe396f8a367266a2ace77f5a75d7184a.tar.gz
pica-pica-f38e00a4fe396f8a367266a2ace77f5a75d7184a.zip
pica-node: remove events before closing c2c sockets, not after, fixes libevent warnings
Diffstat (limited to 'PICA_node.c')
-rw-r--r--PICA_node.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/PICA_node.c b/PICA_node.c
index 6977ce1..a8810d4 100644
--- a/PICA_node.c
+++ b/PICA_node.c
@@ -1298,13 +1298,6 @@ void cclink_list_delete(struct cclink *l)
if (l->p1)
{
- if (l->sck_p1 != -1)
- {
- SHUTDOWN(l->sck_p1);
- CLOSE(l->sck_p1);
- PICA_debug2("closed c2c socket %i", l->sck_p1);
- }
-
if (l->ev_read_p1)
{
event_del(l->ev_read_p1);
@@ -1316,19 +1309,20 @@ void cclink_list_delete(struct cclink *l)
event_del(l->ev_write_p1);
event_free(l->ev_write_p1);
}
+
+ if (l->sck_p1 != -1)
+ {
+ SHUTDOWN(l->sck_p1);
+ CLOSE(l->sck_p1);
+ PICA_debug2("closed c2c socket %i", l->sck_p1);
+ }
+
}//caller_id is stored in p1 structure
else
free(l->caller_id);//caller_id was allocated by malloc
if (l->p2)
{
- if (l->sck_p2 != -1)
- {
- SHUTDOWN(l->sck_p2);
- CLOSE(l->sck_p2);
- PICA_debug2("closed c2c socket %i", l->sck_p2);
- }
-
if (l->ev_read_p2)
{
event_del(l->ev_read_p2);
@@ -1340,6 +1334,13 @@ void cclink_list_delete(struct cclink *l)
event_del(l->ev_write_p2);
event_free(l->ev_write_p2);
}
+
+ if (l->sck_p2 != -1)
+ {
+ SHUTDOWN(l->sck_p2);
+ CLOSE(l->sck_p2);
+ PICA_debug2("closed c2c socket %i", l->sck_p2);
+ }
}
else
free(l->callee_id);