#define DEBUG(...) \
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
-#if ENABLE_MALICIOUS
-/**
- * Should this peer act malicious?
- */
-extern unsigned int malicious;
-#endif
-
/**
* Linked list of messages to send to clients.
*/
GNUNET_h2s (&cqr->key),
cqr->replication,
cqr->seen_replies_count);
- struct GNUNET_PeerIdentity best_known_dest;
- struct GNUNET_HashCode intermediate_trail_id;
- memset (&best_known_dest, 0, sizeof (struct GNUNET_PeerIdentity));
- memset (&intermediate_trail_id, 0, sizeof (struct GNUNET_HashCode));
-
- GDS_NEIGHBOURS_send_get (&cqr->key, cqr->type, cqr->msg_options,
- cqr->replication, best_known_dest,
- intermediate_trail_id , NULL,
- 0, 0, NULL);
-#if 0
- GDS_NEIGHBOURS_send_get (&cqr->key, cqr->type, cqr->msg_options,
- cqr->replication, NULL, NULL , NULL,
- 0, 0, NULL);
-#endif
+ GDS_NEIGHBOURS_handle_get (&cqr->key, cqr->type, cqr->msg_options,
+ cqr->replication);
+
/* exponential back-off for retries.
* max GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD (15 min) */
cqr->retry_frequency = GNUNET_TIME_STD_BACKOFF (cqr->retry_frequency);
ntohl (put_msg->type),
size - sizeof (struct GNUNET_DHT_ClientPutMessage),
&put_msg[1]);
- /* FIXME: Should we store locally? */
-/* GDS_DATACACHE_handle_put (GNUNET_TIME_absolute_ntoh (put_msg->expiration),
- &put_msg->key, 0, NULL, ntohl (put_msg->type),
- size - sizeof (struct GNUNET_DHT_ClientPutMessage),
- &put_msg[1]);*/
- struct GNUNET_PeerIdentity my_identity = GDS_NEIGHBOURS_get_my_id();
- struct GNUNET_PeerIdentity best_known_destination;
- struct GNUNET_HashCode intermediate_trail_id;
-
- memset(&best_known_destination, 0 , sizeof (struct GNUNET_PeerIdentity));
- memset(&intermediate_trail_id, 0, sizeof (struct GNUNET_HashCode));
-
- GDS_NEIGHBOURS_send_put (&put_msg->key,
- ntohl (put_msg->type), ntohl (put_msg->options),
- ntohl (put_msg->desired_replication_level),
- best_known_destination,
- intermediate_trail_id, NULL, 0, 0, NULL,
- GNUNET_TIME_absolute_ntoh (put_msg->expiration),
- &put_msg[1],
- size - sizeof (struct GNUNET_DHT_ClientPutMessage));
-#if 0
- GDS_NEIGHBOURS_send_put (&put_msg->key,
- ntohl (put_msg->type), ntohl (put_msg->options),
- ntohl (put_msg->desired_replication_level), NULL,
- NULL, NULL, 0, 0, NULL,
- GNUNET_TIME_absolute_ntoh (put_msg->expiration),
- &put_msg[1],
- size - sizeof (struct GNUNET_DHT_ClientPutMessage));
-
-#endif
- GDS_CLIENTS_process_put (ntohl (put_msg->options),
- ntohl (put_msg->type),
- 0,
- ntohl (put_msg->desired_replication_level),
- 1,
- &my_identity,
- GNUNET_TIME_absolute_ntoh (put_msg->expiration),
- &put_msg->key,
- &put_msg[1],
- size - sizeof (struct GNUNET_DHT_ClientPutMessage));
-
+ GDS_NEIGHBOURS_handle_put (&put_msg->key,
+ ntohl (put_msg->type), ntohl (put_msg->options),
+ ntohl (put_msg->desired_replication_level),
+ GNUNET_TIME_absolute_ntoh (put_msg->expiration),
+ &put_msg[1],
+ size - sizeof (struct GNUNET_DHT_ClientPutMessage));
pm = GNUNET_malloc (sizeof (struct PendingMessage) +
sizeof (struct GNUNET_DHT_ClientPutConfirmationMessage));
conf = (struct GNUNET_DHT_ClientPutConfirmationMessage *) &pm[1];
#if ENABLE_MALICIOUS
/**
- * Handler for act malicous message.
+ * Handler for act malicious message.
*
* @param cls closure for the service
* @param client the client we received this message from
handle_dht_act_malicious (void *cls, struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- /* FIXME: parse message and set malicious */
const struct GNUNET_DHT_ActMaliciousMessage *msg;
- unsigned int malicious;
-
+ struct PendingMessage *pm;
+ struct GNUNET_DHT_ClientActMaliciousConfirmationMessage *conf;
+ unsigned int malicious_action;
+
msg = (const struct GNUNET_DHT_ActMaliciousMessage *)message;
- malicious = msg->action;
- GDS_NEIGHBOURS_act_malicious(malicious);
+ malicious_action = msg->action;
+
+ if(GNUNET_OK == GDS_NEIGHBOURS_act_malicious (malicious_action))
+ {
+ pm = GNUNET_malloc (sizeof (struct PendingMessage) +
+ sizeof (struct GNUNET_DHT_ClientActMaliciousConfirmationMessage));
+ conf = (struct GNUNET_DHT_ClientActMaliciousConfirmationMessage *) &pm[1];
+ conf->header.size = htons (sizeof (struct GNUNET_DHT_ClientActMaliciousConfirmationMessage));
+ conf->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_CLIENT_ACT_MALICIOUS_OK);
+ pm->msg = &conf->header;
+ add_pending_message (find_active_client (client), pm);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ }
}
#endif