fs_unindex.c | fs_unindex.c | |||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
* @author Christian Grothoff | * @author Christian Grothoff | |||
* @brief Unindex file. | * @brief Unindex file. | |||
*/ | */ | |||
#include "platform.h" | #include "platform.h" | |||
#include "gnunet_constants.h" | #include "gnunet_constants.h" | |||
#include "gnunet_fs_service.h" | #include "gnunet_fs_service.h" | |||
#include "gnunet_protocols.h" | #include "gnunet_protocols.h" | |||
#include "fs_api.h" | #include "fs_api.h" | |||
#include "fs_tree.h" | #include "fs_tree.h" | |||
#define DEBUG_UNINDEX GNUNET_EXTRA_LOGGING | ||||
/** | /** | |||
* Function called by the tree encoder to obtain | * Function called by the tree encoder to obtain | |||
* a block of plaintext data (for the lowest level | * a block of plaintext data (for the lowest level | |||
* of the tree). | * of the tree). | |||
* | * | |||
* @param cls our publishing context | * @param cls our publishing context | |||
* @param offset identifies which block to get | * @param offset identifies which block to get | |||
* @param max (maximum) number of bytes to get; returning | * @param max (maximum) number of bytes to get; returning | |||
* fewer will also cause errors | * fewer will also cause errors | |||
* @param buf where to copy the plaintext buffer | * @param buf where to copy the plaintext buffer | |||
skipping to change at line 157 | skipping to change at line 155 | |||
process_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expir ation, const char *msg) | process_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expir ation, const char *msg) | |||
{ | { | |||
struct GNUNET_FS_UnindexContext *uc = cls; | struct GNUNET_FS_UnindexContext *uc = cls; | |||
if (success == GNUNET_SYSERR) | if (success == GNUNET_SYSERR) | |||
{ | { | |||
uc->emsg = GNUNET_strdup (msg); | uc->emsg = GNUNET_strdup (msg); | |||
signal_unindex_error (uc); | signal_unindex_error (uc); | |||
return; | return; | |||
} | } | |||
#if DEBUG_UNINDEX | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Datastore REMOVE operation succeeded\n"); | "Datastore REMOVE operation succeeded\n"); | |||
#endif | ||||
GNUNET_FS_tree_encoder_next (uc->tc); | GNUNET_FS_tree_encoder_next (uc->tc); | |||
} | } | |||
/** | /** | |||
* Function called asking for the current (encoded) | * Function called asking for the current (encoded) | |||
* block to be processed. After processing the | * block to be processed. After processing the | |||
* client should either call "GNUNET_FS_tree_encode_next" | * client should either call "GNUNET_FS_tree_encode_next" | |||
* or (on error) "GNUNET_FS_tree_encode_finish". | * or (on error) "GNUNET_FS_tree_encode_finish". | |||
* | * | |||
* @param cls closure | * @param cls closure | |||
skipping to change at line 200 | skipping to change at line 196 | |||
size = block_size; | size = block_size; | |||
data = block; | data = block; | |||
} | } | |||
else /* on-demand encoded DBLOCK */ | else /* on-demand encoded DBLOCK */ | |||
{ | { | |||
size = sizeof (struct OnDemandBlock); | size = sizeof (struct OnDemandBlock); | |||
odb.offset = GNUNET_htonll (offset); | odb.offset = GNUNET_htonll (offset); | |||
odb.file_id = uc->file_id; | odb.file_id = uc->file_id; | |||
data = &odb; | data = &odb; | |||
} | } | |||
#if DEBUG_UNINDEX | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Sending REMOVE request to DATASTORE service\n"); | "Sending REMOVE request to DATASTORE service\n"); | |||
#endif | ||||
GNUNET_DATASTORE_remove (uc->dsh, &chk->query, size, data, -2, 1, | GNUNET_DATASTORE_remove (uc->dsh, &chk->query, size, data, -2, 1, | |||
GNUNET_CONSTANTS_SERVICE_TIMEOUT, &process_cont, uc); | GNUNET_CONSTANTS_SERVICE_TIMEOUT, &process_cont, uc); | |||
} | } | |||
/** | /** | |||
* Function called with the response from the | * Function called with the response from the | |||
* FS service to our unindexing request. | * FS service to our unindexing request. | |||
* | * | |||
* @param cls closure, unindex context | * @param cls closure, unindex context | |||
* @param msg NULL on timeout, otherwise the response | * @param msg NULL on timeout, otherwise the response | |||
skipping to change at line 295 | skipping to change at line 289 | |||
uc->client = GNUNET_CLIENT_connect ("fs", uc->h->cfg); | uc->client = GNUNET_CLIENT_connect ("fs", uc->h->cfg); | |||
if (uc->client == NULL) | if (uc->client == NULL) | |||
{ | { | |||
uc->state = UNINDEX_STATE_ERROR; | uc->state = UNINDEX_STATE_ERROR; | |||
uc->emsg = | uc->emsg = | |||
GNUNET_strdup (_("Failed to connect to FS service for unindexing.") ); | GNUNET_strdup (_("Failed to connect to FS service for unindexing.") ); | |||
GNUNET_FS_unindex_sync_ (uc); | GNUNET_FS_unindex_sync_ (uc); | |||
signal_unindex_error (uc); | signal_unindex_error (uc); | |||
return; | return; | |||
} | } | |||
#if DEBUG_UNINDEX | ||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"Sending UNINDEX message to FS service\n"); | "Sending UNINDEX message to FS service\n"); | |||
#endif | ||||
req.header.size = htons (sizeof (struct UnindexMessage)); | req.header.size = htons (sizeof (struct UnindexMessage)); | |||
req.header.type = htons (GNUNET_MESSAGE_TYPE_FS_UNINDEX); | req.header.type = htons (GNUNET_MESSAGE_TYPE_FS_UNINDEX); | |||
req.reserved = 0; | req.reserved = 0; | |||
req.file_id = uc->file_id; | req.file_id = uc->file_id; | |||
GNUNET_break (GNUNET_OK == | GNUNET_break (GNUNET_OK == | |||
GNUNET_CLIENT_transmit_and_get_response (uc->client, | GNUNET_CLIENT_transmit_and_get_response (uc->client, | |||
&req.header, | &req.header, | |||
GNUNET_CONSTANTS_S ERVICE_TIMEOUT, | GNUNET_CONSTANTS_S ERVICE_TIMEOUT, | |||
GNUNET_YES, | GNUNET_YES, | |||
&process_fs_respon se, | &process_fs_respon se, | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 0 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/ |