gnunet-dht-put.c | gnunet-dht-put.c | |||
---|---|---|---|---|
skipping to change at line 99 | skipping to change at line 99 | |||
/** | /** | |||
* Signature of the main function of a task. | * Signature of the main function of a task. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param tc context information (why was this task triggered now) | * @param tc context information (why was this task triggered now) | |||
*/ | */ | |||
void | void | |||
message_sent_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc ) | message_sent_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc ) | |||
{ | { | |||
if (verbose) | if (verbose) | |||
fprintf (stderr, _("PUT request sent!\n")); | FPRINTF (stderr, "%s", _("PUT request sent!\n")); | |||
GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); | |||
} | } | |||
/** | /** | |||
* Main function that will be run by the scheduler. | * Main function that will be run by the scheduler. | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
* @param args remaining command-line arguments | * @param args remaining command-line arguments | |||
* @param cfgfile name of the configuration file used (for saving, can be N ULL!) | * @param cfgfile name of the configuration file used (for saving, can be N ULL!) | |||
* @param c configuration | * @param c configuration | |||
skipping to change at line 123 | skipping to change at line 123 | |||
const struct GNUNET_CONFIGURATION_Handle *c) | const struct GNUNET_CONFIGURATION_Handle *c) | |||
{ | { | |||
struct GNUNET_TIME_Relative timeout; | struct GNUNET_TIME_Relative timeout; | |||
struct GNUNET_TIME_Absolute expiration; | struct GNUNET_TIME_Absolute expiration; | |||
GNUNET_HashCode key; | GNUNET_HashCode key; | |||
cfg = c; | cfg = c; | |||
if ((query_key == NULL) || (data == NULL)) | if ((query_key == NULL) || (data == NULL)) | |||
{ | { | |||
fprintf (stderr, _("Must provide KEY and DATA for DHT put!\n")); | FPRINTF (stderr, "%s", _("Must provide KEY and DATA for DHT put!\n")); | |||
ret = 1; | ret = 1; | |||
return; | return; | |||
} | } | |||
dht_handle = GNUNET_DHT_connect (cfg, 1); | dht_handle = GNUNET_DHT_connect (cfg, 1); | |||
if (dht_handle == NULL) | if (dht_handle == NULL) | |||
{ | { | |||
fprintf (stderr, _("Could not connect to %s service!\n"), "DHT"); | FPRINTF (stderr, _("Could not connect to %s service!\n"), "DHT"); | |||
ret = 1; | ret = 1; | |||
return; | return; | |||
} | } | |||
else if (verbose) | else if (verbose) | |||
fprintf (stderr, _("Connected to %s service!\n"), "DHT"); | FPRINTF (stderr, _("Connected to %s service!\n"), "DHT"); | |||
if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */ | if (query_type == GNUNET_BLOCK_TYPE_ANY) /* Type of data not set */ | |||
query_type = GNUNET_BLOCK_TYPE_TEST; | query_type = GNUNET_BLOCK_TYPE_TEST; | |||
GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); | GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); | |||
timeout = | timeout = | |||
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_requ est); | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_requ est); | |||
expiration = | expiration = | |||
GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply | GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply | |||
(GNUNET_TIME_UNIT_SECONDS, | (GNUNET_TIME_UNIT_SECONDS, | |||
expiration_seconds)); | expiration_seconds)); | |||
if (verbose) | if (verbose) | |||
fprintf (stderr, _("Issuing put request for `%s' with data `%s'!\n"), | FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"), | |||
query_key, data); | query_key, data); | |||
GNUNET_DHT_put (dht_handle, &key, replication, GNUNET_DHT_RO_NONE, query_ type, | GNUNET_DHT_put (dht_handle, &key, replication, GNUNET_DHT_RO_NONE, query_ type, | |||
strlen (data), data, expiration, timeout, &message_sent_c ont, | strlen (data), data, expiration, timeout, &message_sent_c ont, | |||
NULL); | NULL); | |||
} | } | |||
/** | /** | |||
* gnunet-dht-put command line options | * gnunet-dht-put command line options | |||
*/ | */ | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |