1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
commit c24f2cf55eee9a5aefe27bcb34822a5737f170cf
Author: Timo Teras <timo.teras@iki.fi>
Date: Mon Sep 14 08:25:09 2009 +0300
peer: reset both events when script triggers
otherwise we can get same callback twice.
diff --git a/nhrp/nhrp_peer.c b/nhrp/nhrp_peer.c
index b447784..e5721a5 100644
--- a/nhrp/nhrp_peer.c
+++ b/nhrp/nhrp_peer.c
@@ -308,14 +308,16 @@ struct nhrp_peer *nhrp_peer_from_event(union nhrp_peer_event e, int revents)
if (revents & EV_CHILD) {
peer = container_of(e.child, struct nhrp_peer, child);
- ev_timer_stop(&peer->timer);
} else if (revents & EV_TIMEOUT) {
peer = container_of(e.timer, struct nhrp_peer, timer);
- ev_child_stop(&peer->child);
} else {
NHRP_BUG_ON(revents != 0);
peer = container_of(e.child, struct nhrp_peer, child);
}
+
+ ev_child_stop(&peer->child);
+ ev_timer_stop(&peer->timer);
+
return peer;
}
diff --git a/nhrp/nhrp_server.c b/nhrp/nhrp_server.c
index d928886..ad6e292 100644
--- a/nhrp/nhrp_server.c
+++ b/nhrp/nhrp_server.c
@@ -195,13 +195,18 @@ static void nhrp_server_finish_reg(struct nhrp_pending_request *pr)
static void nhrp_server_finish_cie_reg_cb(union nhrp_peer_event e, int revents)
{
- struct nhrp_peer *peer = nhrp_peer_from_event(e, revents);
- struct nhrp_pending_request *pr = peer->request;
- struct nhrp_packet *packet = pr->packet;
- struct nhrp_cie *cie = pr->cie;
+ struct nhrp_peer *peer;
+ struct nhrp_pending_request *pr;
+ struct nhrp_packet *packet;
+ struct nhrp_cie *cie;
struct nhrp_peer_selector sel;
char tmp[64], reason[32];
+ peer = nhrp_peer_from_event(e, revents);
+ pr = peer->request;
+ packet = pr->packet;
+ cie = pr->cie;
+
peer->request = NULL;
nhrp_address_format(&peer->protocol_address, sizeof(tmp), tmp);
if (revents != 0 && nhrp_peer_event_ok(e, revents)) {
|