diff options
Diffstat (limited to 'src/rps/gnunet-rps.c')
-rw-r--r-- | src/rps/gnunet-rps.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c index 01be2aeb3..705c2c9b0 100644 --- a/src/rps/gnunet-rps.c +++ b/src/rps/gnunet-rps.c | |||
@@ -46,12 +46,6 @@ static struct GNUNET_PeerIdentity *peer_id; | |||
46 | 46 | ||
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Shutdown task | ||
50 | */ | ||
51 | static struct GNUNET_SCHEDULER_Task *shutdown_task; | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Set an option of type 'struct GNUNET_PeerIdentity *' from the command line. | 49 | * Set an option of type 'struct GNUNET_PeerIdentity *' from the command line. |
56 | * A pointer to this function should be passed as part of the | 50 | * A pointer to this function should be passed as part of the |
57 | * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options | 51 | * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options |
@@ -96,7 +90,6 @@ GNUNET_GETOPT_set_peerid (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
96 | static void | 90 | static void |
97 | do_shutdown (void *cls) | 91 | do_shutdown (void *cls) |
98 | { | 92 | { |
99 | shutdown_task = NULL; | ||
100 | if (NULL != req_handle) | 93 | if (NULL != req_handle) |
101 | GNUNET_RPS_request_cancel (req_handle); | 94 | GNUNET_RPS_request_cancel (req_handle); |
102 | GNUNET_RPS_disconnect (rps_handle); | 95 | GNUNET_RPS_disconnect (rps_handle); |
@@ -126,8 +119,7 @@ reply_handle (void *cls, | |||
126 | } | 119 | } |
127 | ret = 0; | 120 | ret = 0; |
128 | 121 | ||
129 | GNUNET_SCHEDULER_cancel (shutdown_task); | 122 | GNUNET_SCHEDULER_shutdown (); |
130 | GNUNET_SCHEDULER_add_now (do_shutdown, NULL); | ||
131 | } | 123 | } |
132 | 124 | ||
133 | 125 | ||
@@ -156,15 +148,14 @@ run (void *cls, | |||
156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
157 | "Requesting %u PeerIDs\n", num_peers); | 149 | "Requesting %u PeerIDs\n", num_peers); |
158 | req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL); | 150 | req_handle = GNUNET_RPS_request_peers (rps_handle, num_peers, reply_handle, NULL); |
159 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 151 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
160 | &do_shutdown, NULL); | ||
161 | } | 152 | } |
162 | else | 153 | else |
163 | { /* Seed PeerID */ | 154 | { /* Seed PeerID */ |
164 | GNUNET_RPS_seed_ids (rps_handle, 1, peer_id); | 155 | GNUNET_RPS_seed_ids (rps_handle, 1, peer_id); |
165 | FPRINTF (stdout, "Seeded PeerID %s\n", GNUNET_i2s_full (peer_id)); | 156 | FPRINTF (stdout, "Seeded PeerID %s\n", GNUNET_i2s_full (peer_id)); |
166 | ret = 0; | 157 | ret = 0; |
167 | GNUNET_SCHEDULER_add_now (do_shutdown, NULL); | 158 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
168 | } | 159 | } |
169 | } | 160 | } |
170 | 161 | ||