diff options
author | Julius Bünger <buenger@mytum.de> | 2018-07-13 01:11:32 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-07-13 01:16:00 +0200 |
commit | f5164502be55aa48ea4c3b44167e19ac15ba53af (patch) | |
tree | 725e083a3d7926075ed4facfbaef85029568eb8a /src | |
parent | 4438597b90a7ed009e96aef280fd3be0b1576076 (diff) | |
download | gnunet-f5164502be55aa48ea4c3b44167e19ac15ba53af.tar.gz gnunet-f5164502be55aa48ea4c3b44167e19ac15ba53af.zip |
rps profiler: proper disconnect from service
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 02259d628..a06598764 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -883,6 +883,9 @@ static int check_statistics_collect_completed () | |||
883 | return GNUNET_YES; | 883 | return GNUNET_YES; |
884 | } | 884 | } |
885 | 885 | ||
886 | static void | ||
887 | rps_disconnect_adapter (void *cls, | ||
888 | void *op_result); | ||
886 | 889 | ||
887 | static void | 890 | static void |
888 | cancel_pending_req (struct PendingRequest *pending_req) | 891 | cancel_pending_req (struct PendingRequest *pending_req) |
@@ -928,15 +931,8 @@ clean_peer (unsigned peer_index) | |||
928 | cancel_request (pending_rep); | 931 | cancel_request (pending_rep); |
929 | } | 932 | } |
930 | pending_req = rps_peers[peer_index].pending_req_head; | 933 | pending_req = rps_peers[peer_index].pending_req_head; |
931 | while (NULL != (pending_req = rps_peers[peer_index].pending_req_head)) | 934 | rps_disconnect_adapter (&rps_peers[peer_index], |
932 | { | 935 | &rps_peers[peer_index].rps_handle); |
933 | cancel_pending_req (pending_req); | ||
934 | } | ||
935 | if (NULL != rps_peers[peer_index].rps_handle) | ||
936 | { | ||
937 | GNUNET_RPS_disconnect (rps_peers[peer_index].rps_handle); | ||
938 | rps_peers[peer_index].rps_handle = NULL; | ||
939 | } | ||
940 | for (unsigned stat_type = STAT_TYPE_ROUNDS; | 936 | for (unsigned stat_type = STAT_TYPE_ROUNDS; |
941 | stat_type < STAT_TYPE_MAX; | 937 | stat_type < STAT_TYPE_MAX; |
942 | stat_type++) | 938 | stat_type++) |
@@ -1277,6 +1273,7 @@ rps_disconnect_adapter (void *cls, | |||
1277 | { | 1273 | { |
1278 | struct RPSPeer *peer = cls; | 1274 | struct RPSPeer *peer = cls; |
1279 | struct GNUNET_RPS_Handle *h = op_result; | 1275 | struct GNUNET_RPS_Handle *h = op_result; |
1276 | struct PendingRequest *pending_req; | ||
1280 | 1277 | ||
1281 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1278 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1282 | "disconnect_adapter (%u)\n", | 1279 | "disconnect_adapter (%u)\n", |
@@ -1284,6 +1281,10 @@ rps_disconnect_adapter (void *cls, | |||
1284 | GNUNET_assert (NULL != peer); | 1281 | GNUNET_assert (NULL != peer); |
1285 | if (NULL != peer->rps_handle) | 1282 | if (NULL != peer->rps_handle) |
1286 | { | 1283 | { |
1284 | while (NULL != (pending_req = peer->pending_req_head)) | ||
1285 | { | ||
1286 | cancel_pending_req (pending_req); | ||
1287 | } | ||
1287 | GNUNET_assert (h == peer->rps_handle); | 1288 | GNUNET_assert (h == peer->rps_handle); |
1288 | GNUNET_RPS_disconnect (h); | 1289 | GNUNET_RPS_disconnect (h); |
1289 | peer->rps_handle = NULL; | 1290 | peer->rps_handle = NULL; |