FS-9775: Added support for removing finished transactions via latent purging while expiring

Also added support to send error message responses and updated the test to confirm, errors still need to be updated to send an error responses
This commit is contained in:
Shane Bryldt authored and Mike Jerris committed 2017-01-25 14:59:34 -06:00
1 parent f95ca83b06
commit 7ac7a7e75b
6 files changed
+290 -47

No files matched your search

+27
View File
@@ -207,6 +207,33 @@ KS_DECLARE(ks_status_t) ks_dht2_message_response(ks_dht2_message_t *message,
return KS_STATUS_SUCCESS;
}
/**
*
*/
KS_DECLARE(ks_status_t) ks_dht2_message_error(ks_dht2_message_t *message,
uint8_t *transactionid,
ks_size_t transactionid_length,
struct bencode **args)
{
struct bencode *e;
ks_assert(message);
ks_assert(transactionid);
ben_dict_set(message->data, ben_blob("t", 1), ben_blob(transactionid, transactionid_length));
ben_dict_set(message->data, ben_blob("y", 1), ben_blob("e", 1));
// @note r joins message->data and will be freed with it
e = ben_list();
ben_dict_set(message->data, ben_blob("e", 1), e);
if (args) {
*args = e;
}
return KS_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables: