diff options
Diffstat (limited to 'src/dht/gnunet-dht-put.c')
-rw-r--r-- | src/dht/gnunet-dht-put.c | 81 |
1 files changed, 26 insertions, 55 deletions
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index f183fe588..db4d04681 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c | |||
@@ -103,34 +103,12 @@ shutdown_task (void *cls) | |||
103 | * Signature of the main function of a task. | 103 | * Signature of the main function of a task. |
104 | * | 104 | * |
105 | * @param cls closure | 105 | * @param cls closure |
106 | * @param success #GNUNET_OK if the PUT was transmitted, | ||
107 | * #GNUNET_NO on timeout, | ||
108 | * #GNUNET_SYSERR on disconnect from service | ||
109 | * after the PUT message was transmitted | ||
110 | * (so we don't know if it was received or not) | ||
111 | */ | 106 | */ |
112 | static void | 107 | static void |
113 | message_sent_cont (void *cls, int success) | 108 | message_sent_cont (void *cls) |
114 | { | 109 | { |
115 | if (verbose) | 110 | GNUNET_SCHEDULER_add_now (&shutdown_task, |
116 | { | 111 | NULL); |
117 | switch (success) | ||
118 | { | ||
119 | case GNUNET_OK: | ||
120 | FPRINTF (stderr, "%s `%s'!\n", _("PUT request sent with key"), GNUNET_h2s_full(&key)); | ||
121 | break; | ||
122 | case GNUNET_NO: | ||
123 | FPRINTF (stderr, "%s", _("Timeout sending PUT request!\n")); | ||
124 | break; | ||
125 | case GNUNET_SYSERR: | ||
126 | FPRINTF (stderr, "%s", _("PUT request not confirmed!\n")); | ||
127 | break; | ||
128 | default: | ||
129 | GNUNET_break (0); | ||
130 | break; | ||
131 | } | ||
132 | } | ||
133 | GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | ||
134 | } | 112 | } |
135 | 113 | ||
136 | 114 | ||
@@ -160,7 +138,8 @@ run (void *cls, | |||
160 | 138 | ||
161 | if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) | 139 | if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) |
162 | { | 140 | { |
163 | FPRINTF (stderr, _("Could not connect to %s service!\n"), "DHT"); | 141 | FPRINTF (stderr, |
142 | _("Could not connect to DHT service!\n")); | ||
164 | ret = 1; | 143 | ret = 1; |
165 | return; | 144 | return; |
166 | } | 145 | } |
@@ -203,55 +182,47 @@ main (int argc, char *const *argv) | |||
203 | { | 182 | { |
204 | 183 | ||
205 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 184 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
206 | |||
207 | GNUNET_GETOPT_option_string ('d', | 185 | GNUNET_GETOPT_option_string ('d', |
208 | "data", | 186 | "data", |
209 | "DATA", | 187 | "DATA", |
210 | gettext_noop ("the data to insert under the key"), | 188 | gettext_noop ("the data to insert under the key"), |
211 | &data), | 189 | &data), |
212 | |||
213 | GNUNET_GETOPT_option_relative_time ('e', | 190 | GNUNET_GETOPT_option_relative_time ('e', |
214 | "expiration", | 191 | "expiration", |
215 | "EXPIRATION", | 192 | "EXPIRATION", |
216 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | 193 | gettext_noop ("how long to store this entry in the dht (in seconds)"), |
217 | &expiration), | 194 | &expiration), |
218 | |||
219 | GNUNET_GETOPT_option_string ('k', | 195 | GNUNET_GETOPT_option_string ('k', |
220 | "key", | 196 | "key", |
221 | "KEY", | 197 | "KEY", |
222 | gettext_noop ("the query key"), | 198 | gettext_noop ("the query key"), |
223 | &query_key), | 199 | &query_key), |
224 | |||
225 | GNUNET_GETOPT_option_flag ('x', | 200 | GNUNET_GETOPT_option_flag ('x', |
226 | "demultiplex", | 201 | "demultiplex", |
227 | gettext_noop ("use DHT's demultiplex everywhere option"), | 202 | gettext_noop ("use DHT's demultiplex everywhere option"), |
228 | &demultixplex_everywhere), | 203 | &demultixplex_everywhere), |
229 | |||
230 | GNUNET_GETOPT_option_uint ('r', | 204 | GNUNET_GETOPT_option_uint ('r', |
231 | "replication", | 205 | "replication", |
232 | "LEVEL", | 206 | "LEVEL", |
233 | gettext_noop ("how many replicas to create"), | 207 | gettext_noop ("how many replicas to create"), |
234 | &replication), | 208 | &replication), |
235 | |||
236 | GNUNET_GETOPT_option_flag ('R', | 209 | GNUNET_GETOPT_option_flag ('R', |
237 | "record", | 210 | "record", |
238 | gettext_noop ("use DHT's record route option"), | 211 | gettext_noop ("use DHT's record route option"), |
239 | &record_route), | 212 | &record_route), |
240 | |||
241 | GNUNET_GETOPT_option_uint ('t', | 213 | GNUNET_GETOPT_option_uint ('t', |
242 | "type", | 214 | "type", |
243 | "TYPE", | 215 | "TYPE", |
244 | gettext_noop ("the type to insert data as"), | 216 | gettext_noop ("the type to insert data as"), |
245 | &query_type), | 217 | &query_type), |
246 | |||
247 | GNUNET_GETOPT_option_verbose (&verbose), | 218 | GNUNET_GETOPT_option_verbose (&verbose), |
248 | |||
249 | GNUNET_GETOPT_OPTION_END | 219 | GNUNET_GETOPT_OPTION_END |
250 | }; | 220 | }; |
251 | 221 | ||
252 | 222 | ||
253 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, | 223 | if (GNUNET_OK != |
254 | &argc, &argv)) | 224 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
225 | &argc, &argv)) | ||
255 | return 2; | 226 | return 2; |
256 | expiration = GNUNET_TIME_UNIT_HOURS; | 227 | expiration = GNUNET_TIME_UNIT_HOURS; |
257 | return (GNUNET_OK == | 228 | return (GNUNET_OK == |