diff options
author | Laurent Ghigonis <laurent@p1sec.com> | 2013-07-06 02:24:06 +0200 |
---|---|---|
committer | Laurent Ghigonis <laurent@p1sec.com> | 2013-07-06 02:24:06 +0200 |
commit | 44577d7576cdef592918350a5e3c5cbf6d15f548 (patch) | |
tree | e0feedfe84c17b5486802089779bb04f0948ee83 | |
parent | libglouglou: traceroute test for intf_open() failure (diff) | |
download | glouglou-44577d7576cdef592918350a5e3c5cbf6d15f548.tar.xz glouglou-44577d7576cdef592918350a5e3c5cbf6d15f548.zip |
libglouglou: traceroute correctly count pending requests
-rw-r--r-- | libglouglou/libggnet_traceroute.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libglouglou/libggnet_traceroute.c b/libglouglou/libggnet_traceroute.c index 37fbe6b..542b3f3 100644 --- a/libglouglou/libggnet_traceroute.c +++ b/libglouglou/libggnet_traceroute.c @@ -237,6 +237,7 @@ ggnet_traceroute_trace(struct ggnet_traceroute *ggtr, struct addr *ip, req->ggtr = ggtr; LIST_INSERT_HEAD(&ggtr->req_list, req, entry); + ggtr->req_pending++; return req; err: @@ -248,8 +249,15 @@ err: void ggnet_traceroute_trace_free(struct ggnet_traceroute_req *req) { - LIST_REMOVE(req, entry); - ggtr->req_pending--; + + struct ggnet_traceroute_req *r; + + LIST_FOREACH(r, &req->ggtr->req_list, entry) { + if (r == req) { + LIST_REMOVE(req, entry); + req->ggtr->req_pending--; + } + } _req_free(req); } @@ -571,6 +579,9 @@ _trace_done(struct ggnet_traceroute_req *req) req->hopcount_total = hopcount_total; req->hopcount_answering = hopcount_answering; + LIST_REMOVE(req, entry); + req->ggtr->req_pending--; + req->cb_done(req, req->data); } |