mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-12 18:17:59 +00:00
FS-9775: Most of search functionality is finished, needs testing when route table is ready, still reviewing a few things related to recent lock changes
This commit is contained in:
parent
68e5321da0
commit
73e4c22255
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ KS_BEGIN_EXTERN_C
|
|||||||
#define KS_DHT_MESSAGE_QUERY_MAX_SIZE 20
|
#define KS_DHT_MESSAGE_QUERY_MAX_SIZE 20
|
||||||
#define KS_DHT_MESSAGE_ERROR_MAX_SIZE 256
|
#define KS_DHT_MESSAGE_ERROR_MAX_SIZE 256
|
||||||
|
|
||||||
#define KS_DHT_TRANSACTION_EXPIRATION_DELAY 30
|
#define KS_DHT_TRANSACTION_EXPIRATION 30
|
||||||
#define KS_DHT_SEARCH_EXPIRATION 10
|
#define KS_DHT_SEARCH_EXPIRATION 10
|
||||||
#define KS_DHT_SEARCH_RESULTS_MAX_SIZE 8 // @todo replace with KS_DHTRT_BUCKET_SIZE
|
#define KS_DHT_SEARCH_RESULTS_MAX_SIZE 8 // @todo replace with KS_DHTRT_BUCKET_SIZE
|
||||||
|
|
||||||
|
@ -17,14 +17,11 @@ KS_DECLARE(ks_status_t) ks_dht_datagram_create(ks_dht_datagram_t **datagram,
|
|||||||
ks_assert(endpoint);
|
ks_assert(endpoint);
|
||||||
ks_assert(raddr);
|
ks_assert(raddr);
|
||||||
ks_assert(raddr->family == AF_INET || raddr->family == AF_INET6);
|
ks_assert(raddr->family == AF_INET || raddr->family == AF_INET6);
|
||||||
|
|
||||||
*datagram = dg = ks_pool_alloc(pool, sizeof(ks_dht_datagram_t));
|
|
||||||
if (!dg) {
|
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
dg->pool = pool;
|
|
||||||
|
|
||||||
|
*datagram = dg = ks_pool_alloc(pool, sizeof(ks_dht_datagram_t));
|
||||||
|
ks_assert(dg);
|
||||||
|
|
||||||
|
dg->pool = pool;
|
||||||
dg->dht = dht;
|
dg->dht = dht;
|
||||||
dg->endpoint = endpoint;
|
dg->endpoint = endpoint;
|
||||||
dg->raddr = *raddr;
|
dg->raddr = *raddr;
|
||||||
@ -32,7 +29,7 @@ KS_DECLARE(ks_status_t) ks_dht_datagram_create(ks_dht_datagram_t **datagram,
|
|||||||
memcpy(dg->buffer, dht->recv_buffer, dht->recv_buffer_length);
|
memcpy(dg->buffer, dht->recv_buffer, dht->recv_buffer_length);
|
||||||
dg->buffer_length = dht->recv_buffer_length;
|
dg->buffer_length = dht->recv_buffer_length;
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (dg) ks_dht_datagram_destroy(&dg);
|
if (dg) ks_dht_datagram_destroy(&dg);
|
||||||
*datagram = NULL;
|
*datagram = NULL;
|
||||||
|
@ -18,19 +18,17 @@ KS_DECLARE(ks_status_t) ks_dht_endpoint_create(ks_dht_endpoint_t **endpoint,
|
|||||||
ks_assert(pool);
|
ks_assert(pool);
|
||||||
ks_assert(addr);
|
ks_assert(addr);
|
||||||
ks_assert(addr->family == AF_INET || addr->family == AF_INET6);
|
ks_assert(addr->family == AF_INET || addr->family == AF_INET6);
|
||||||
|
|
||||||
*endpoint = ep = ks_pool_alloc(pool, sizeof(ks_dht_endpoint_t));
|
*endpoint = ep = ks_pool_alloc(pool, sizeof(ks_dht_endpoint_t));
|
||||||
if (!ep) {
|
ks_assert(ep);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
ep->pool = pool;
|
ep->pool = pool;
|
||||||
if (!nodeid) randombytes_buf(ep->nodeid.id, KS_DHT_NODEID_SIZE);
|
if (!nodeid) randombytes_buf(ep->nodeid.id, KS_DHT_NODEID_SIZE);
|
||||||
else memcpy(ep->nodeid.id, nodeid->id, KS_DHT_NODEID_SIZE);
|
else memcpy(ep->nodeid.id, nodeid->id, KS_DHT_NODEID_SIZE);
|
||||||
ep->addr = *addr;
|
ep->addr = *addr;
|
||||||
ep->sock = sock;
|
ep->sock = sock;
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (ep) ks_dht_endpoint_destroy(&ep);
|
if (ep) ks_dht_endpoint_destroy(&ep);
|
||||||
*endpoint = NULL;
|
*endpoint = NULL;
|
||||||
@ -50,9 +48,6 @@ KS_DECLARE(void) ks_dht_endpoint_destroy(ks_dht_endpoint_t **endpoint)
|
|||||||
|
|
||||||
ep = *endpoint;
|
ep = *endpoint;
|
||||||
|
|
||||||
if (ep->node) {
|
|
||||||
// @todo release the node?
|
|
||||||
}
|
|
||||||
if (ep->sock != KS_SOCK_INVALID) ks_socket_close(&ep->sock);
|
if (ep->sock != KS_SOCK_INVALID) ks_socket_close(&ep->sock);
|
||||||
ks_pool_free(ep->pool, ep);
|
ks_pool_free(ep->pool, ep);
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#include "ks_dht.h"
|
#include "ks_dht.h"
|
||||||
#include "ks_dht-int.h"
|
#include "ks_dht-int.h"
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_message_create(ks_dht_message_t **message,
|
KS_DECLARE(ks_status_t) ks_dht_message_create(ks_dht_message_t **message,
|
||||||
ks_pool_t *pool,
|
ks_pool_t *pool,
|
||||||
ks_dht_endpoint_t *endpoint,
|
ks_dht_endpoint_t *endpoint,
|
||||||
@ -17,17 +14,17 @@ KS_DECLARE(ks_status_t) ks_dht_message_create(ks_dht_message_t **message,
|
|||||||
ks_assert(pool);
|
ks_assert(pool);
|
||||||
|
|
||||||
*message = m = ks_pool_alloc(pool, sizeof(ks_dht_message_t));
|
*message = m = ks_pool_alloc(pool, sizeof(ks_dht_message_t));
|
||||||
if (!m) {
|
ks_assert(m);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
m->pool = pool;
|
|
||||||
|
|
||||||
|
m->pool = pool;
|
||||||
m->endpoint = endpoint;
|
m->endpoint = endpoint;
|
||||||
m->raddr = *raddr;
|
m->raddr = *raddr;
|
||||||
if (alloc_data) m->data = ben_dict();
|
if (alloc_data) {
|
||||||
|
m->data = ben_dict();
|
||||||
|
ks_assert(m->data);
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (m) ks_dht_message_destroy(&m);
|
if (m) ks_dht_message_destroy(&m);
|
||||||
*message = NULL;
|
*message = NULL;
|
||||||
@ -35,9 +32,6 @@ KS_DECLARE(ks_status_t) ks_dht_message_create(ks_dht_message_t **message,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(void) ks_dht_message_destroy(ks_dht_message_t **message)
|
KS_DECLARE(void) ks_dht_message_destroy(ks_dht_message_t **message)
|
||||||
{
|
{
|
||||||
ks_dht_message_t *m;
|
ks_dht_message_t *m;
|
||||||
@ -57,9 +51,6 @@ KS_DECLARE(void) ks_dht_message_destroy(ks_dht_message_t **message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_message_parse(ks_dht_message_t *message, const uint8_t *buffer, ks_size_t buffer_length)
|
KS_DECLARE(ks_status_t) ks_dht_message_parse(ks_dht_message_t *message, const uint8_t *buffer, ks_size_t buffer_length)
|
||||||
{
|
{
|
||||||
struct bencode *t;
|
struct bencode *t;
|
||||||
@ -121,9 +112,6 @@ KS_DECLARE(ks_status_t) ks_dht_message_parse(ks_dht_message_t *message, const ui
|
|||||||
return KS_STATUS_SUCCESS;
|
return KS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_message_query(ks_dht_message_t *message,
|
KS_DECLARE(ks_status_t) ks_dht_message_query(ks_dht_message_t *message,
|
||||||
uint32_t transactionid,
|
uint32_t transactionid,
|
||||||
const char *query,
|
const char *query,
|
||||||
@ -143,6 +131,7 @@ KS_DECLARE(ks_status_t) ks_dht_message_query(ks_dht_message_t *message,
|
|||||||
|
|
||||||
// @note r joins message->data and will be freed with it
|
// @note r joins message->data and will be freed with it
|
||||||
a = ben_dict();
|
a = ben_dict();
|
||||||
|
ks_assert(a);
|
||||||
ben_dict_set(message->data, ben_blob("a", 1), a);
|
ben_dict_set(message->data, ben_blob("a", 1), a);
|
||||||
|
|
||||||
if (args) *args = a;
|
if (args) *args = a;
|
||||||
@ -150,9 +139,6 @@ KS_DECLARE(ks_status_t) ks_dht_message_query(ks_dht_message_t *message,
|
|||||||
return KS_STATUS_SUCCESS;
|
return KS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_message_response(ks_dht_message_t *message,
|
KS_DECLARE(ks_status_t) ks_dht_message_response(ks_dht_message_t *message,
|
||||||
uint8_t *transactionid,
|
uint8_t *transactionid,
|
||||||
ks_size_t transactionid_length,
|
ks_size_t transactionid_length,
|
||||||
@ -168,6 +154,7 @@ KS_DECLARE(ks_status_t) ks_dht_message_response(ks_dht_message_t *message,
|
|||||||
|
|
||||||
// @note r joins message->data and will be freed with it
|
// @note r joins message->data and will be freed with it
|
||||||
r = ben_dict();
|
r = ben_dict();
|
||||||
|
ks_assert(r);
|
||||||
ben_dict_set(message->data, ben_blob("r", 1), r);
|
ben_dict_set(message->data, ben_blob("r", 1), r);
|
||||||
|
|
||||||
if (args) *args = r;
|
if (args) *args = r;
|
||||||
@ -193,6 +180,7 @@ KS_DECLARE(ks_status_t) ks_dht_message_error(ks_dht_message_t *message,
|
|||||||
|
|
||||||
// @note r joins message->data and will be freed with it
|
// @note r joins message->data and will be freed with it
|
||||||
e = ben_list();
|
e = ben_list();
|
||||||
|
ks_assert(e);
|
||||||
ben_dict_set(message->data, ben_blob("e", 1), e);
|
ben_dict_set(message->data, ben_blob("e", 1), e);
|
||||||
|
|
||||||
if (args) *args = e;
|
if (args) *args = e;
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
#include "ks_dht-int.h"
|
#include "ks_dht-int.h"
|
||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_search_create(ks_dht_search_t **search, ks_pool_t *pool, const ks_dht_nodeid_t *target)
|
KS_DECLARE(ks_status_t) ks_dht_search_create(ks_dht_search_t **search, ks_pool_t *pool, const ks_dht_nodeid_t *target)
|
||||||
{
|
{
|
||||||
ks_dht_search_t *s;
|
ks_dht_search_t *s;
|
||||||
@ -15,32 +12,27 @@ KS_DECLARE(ks_status_t) ks_dht_search_create(ks_dht_search_t **search, ks_pool_t
|
|||||||
ks_assert(target);
|
ks_assert(target);
|
||||||
|
|
||||||
*search = s = ks_pool_alloc(pool, sizeof(ks_dht_search_t));
|
*search = s = ks_pool_alloc(pool, sizeof(ks_dht_search_t));
|
||||||
if (!s) {
|
ks_assert(s);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
s->pool = pool;
|
s->pool = pool;
|
||||||
|
|
||||||
if ((ret = ks_mutex_create(&s->mutex, KS_MUTEX_FLAG_DEFAULT, s->pool)) != KS_STATUS_SUCCESS) goto done;
|
ks_mutex_create(&s->mutex, KS_MUTEX_FLAG_DEFAULT, s->pool);
|
||||||
|
ks_assert(s->mutex);
|
||||||
|
|
||||||
memcpy(s->target.id, target->id, KS_DHT_NODEID_SIZE);
|
memcpy(s->target.id, target->id, KS_DHT_NODEID_SIZE);
|
||||||
|
|
||||||
if ((ret = ks_hash_create(&s->pending,
|
ks_hash_create(&s->pending, KS_HASH_MODE_ARBITRARY, KS_HASH_FLAG_RWLOCK, s->pool);
|
||||||
KS_HASH_MODE_ARBITRARY,
|
ks_assert(s->pending);
|
||||||
KS_HASH_FLAG_RWLOCK,
|
|
||||||
s->pool)) != KS_STATUS_SUCCESS) goto done;
|
|
||||||
ks_hash_set_keysize(s->pending, KS_DHT_NODEID_SIZE);
|
ks_hash_set_keysize(s->pending, KS_DHT_NODEID_SIZE);
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (s) ks_dht_search_destroy(&s);
|
if (s) ks_dht_search_destroy(&s);
|
||||||
*search = NULL;
|
*search = NULL;
|
||||||
}
|
}
|
||||||
return KS_STATUS_SUCCESS;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(void) ks_dht_search_destroy(ks_dht_search_t **search)
|
KS_DECLARE(void) ks_dht_search_destroy(ks_dht_search_t **search)
|
||||||
{
|
{
|
||||||
ks_dht_search_t *s;
|
ks_dht_search_t *s;
|
||||||
@ -83,7 +75,7 @@ KS_DECLARE(ks_status_t) ks_dht_search_callback_add(ks_dht_search_t *search, ks_d
|
|||||||
search->callbacks = (ks_dht_search_callback_t *)ks_pool_resize(search->pool,
|
search->callbacks = (ks_dht_search_callback_t *)ks_pool_resize(search->pool,
|
||||||
(void *)search->callbacks,
|
(void *)search->callbacks,
|
||||||
sizeof(ks_dht_search_callback_t) * search->callbacks_size);
|
sizeof(ks_dht_search_callback_t) * search->callbacks_size);
|
||||||
if (!search->callbacks) return KS_STATUS_NO_MEM;
|
ks_assert(search->callbacks);
|
||||||
search->callbacks[index] = callback;
|
search->callbacks[index] = callback;
|
||||||
ks_mutex_unlock(search->mutex);
|
ks_mutex_unlock(search->mutex);
|
||||||
}
|
}
|
||||||
@ -97,19 +89,16 @@ KS_DECLARE(ks_status_t) ks_dht_search_pending_create(ks_dht_search_pending_t **p
|
|||||||
|
|
||||||
ks_assert(pending);
|
ks_assert(pending);
|
||||||
ks_assert(pool);
|
ks_assert(pool);
|
||||||
|
|
||||||
*pending = p = ks_pool_alloc(pool, sizeof(ks_dht_search_pending_t));
|
|
||||||
if (!p) {
|
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
p->pool = pool;
|
|
||||||
|
|
||||||
|
*pending = p = ks_pool_alloc(pool, sizeof(ks_dht_search_pending_t));
|
||||||
|
ks_assert(p);
|
||||||
|
|
||||||
|
p->pool = pool;
|
||||||
p->nodeid = *nodeid;
|
p->nodeid = *nodeid;
|
||||||
p->expiration = ks_time_now_sec() + KS_DHT_SEARCH_EXPIRATION;
|
p->expiration = ks_time_now() + (KS_DHT_SEARCH_EXPIRATION * 1000);
|
||||||
p->finished = KS_FALSE;
|
p->finished = KS_FALSE;
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (p) ks_dht_search_pending_destroy(&p);
|
if (p) ks_dht_search_pending_destroy(&p);
|
||||||
*pending = NULL;
|
*pending = NULL;
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
#include "ks_dht-int.h"
|
#include "ks_dht-int.h"
|
||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
KS_DECLARE(ks_status_t) ks_dht_storageitem_create_immutable(ks_dht_storageitem_t **item, ks_pool_t *pool, struct bencode *v)
|
KS_DECLARE(ks_status_t) ks_dht_storageitem_create_immutable(ks_dht_storageitem_t **item, ks_pool_t *pool, struct bencode *v)
|
||||||
{
|
{
|
||||||
ks_dht_storageitem_t *si;
|
ks_dht_storageitem_t *si;
|
||||||
@ -19,27 +16,21 @@ KS_DECLARE(ks_status_t) ks_dht_storageitem_create_immutable(ks_dht_storageitem_t
|
|||||||
ks_assert(SHA_DIGEST_LENGTH == KS_DHT_NODEID_SIZE);
|
ks_assert(SHA_DIGEST_LENGTH == KS_DHT_NODEID_SIZE);
|
||||||
|
|
||||||
*item = si = ks_pool_alloc(pool, sizeof(ks_dht_storageitem_t));
|
*item = si = ks_pool_alloc(pool, sizeof(ks_dht_storageitem_t));
|
||||||
if (!si) {
|
ks_assert(si);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
si->pool = pool;
|
|
||||||
|
|
||||||
|
si->pool = pool;
|
||||||
si->mutable = KS_FALSE;
|
si->mutable = KS_FALSE;
|
||||||
|
|
||||||
si->v = ben_clone(v);
|
si->v = ben_clone(v);
|
||||||
if (!si->v) {
|
ks_assert(si->v);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
enc = ben_encode(&enc_len, si->v);
|
enc = ben_encode(&enc_len, si->v);
|
||||||
|
ks_assert(enc);
|
||||||
SHA1_Init(&sha);
|
SHA1_Init(&sha);
|
||||||
SHA1_Update(&sha, enc, enc_len);
|
SHA1_Update(&sha, enc, enc_len);
|
||||||
SHA1_Final(si->id.id, &sha);
|
SHA1_Final(si->id.id, &sha);
|
||||||
free(enc);
|
free(enc);
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (si) ks_dht_storageitem_destroy(&si);
|
if (si) ks_dht_storageitem_destroy(&si);
|
||||||
*item = NULL;
|
*item = NULL;
|
||||||
@ -70,15 +61,12 @@ KS_DECLARE(ks_status_t) ks_dht_storageitem_create_mutable(ks_dht_storageitem_t *
|
|||||||
ks_assert(signature);
|
ks_assert(signature);
|
||||||
|
|
||||||
*item = si = ks_pool_alloc(pool, sizeof(ks_dht_storageitem_t));
|
*item = si = ks_pool_alloc(pool, sizeof(ks_dht_storageitem_t));
|
||||||
if (!si) {
|
ks_assert(si);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
si->pool = pool;
|
si->pool = pool;
|
||||||
|
|
||||||
si->v = ben_clone(v);
|
|
||||||
|
|
||||||
si->mutable = KS_TRUE;
|
si->mutable = KS_TRUE;
|
||||||
|
si->v = ben_clone(v);
|
||||||
|
ks_assert(si->v);
|
||||||
|
|
||||||
memcpy(si->pk.key, k->key, KS_DHT_STORAGEITEM_KEY_SIZE);
|
memcpy(si->pk.key, k->key, KS_DHT_STORAGEITEM_KEY_SIZE);
|
||||||
if (salt && salt_length > 0) {
|
if (salt && salt_length > 0) {
|
||||||
@ -93,7 +81,7 @@ KS_DECLARE(ks_status_t) ks_dht_storageitem_create_mutable(ks_dht_storageitem_t *
|
|||||||
if (si->salt && si->salt_length > 0) SHA1_Update(&sha, si->salt, si->salt_length);
|
if (si->salt && si->salt_length > 0) SHA1_Update(&sha, si->salt, si->salt_length);
|
||||||
SHA1_Final(si->id.id, &sha);
|
SHA1_Final(si->id.id, &sha);
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (si) ks_dht_storageitem_destroy(&si);
|
if (si) ks_dht_storageitem_destroy(&si);
|
||||||
*item = NULL;
|
*item = NULL;
|
||||||
|
@ -15,18 +15,15 @@ KS_DECLARE(ks_status_t) ks_dht_transaction_create(ks_dht_transaction_t **transac
|
|||||||
ks_assert(raddr);
|
ks_assert(raddr);
|
||||||
|
|
||||||
*transaction = t = ks_pool_alloc(pool, sizeof(ks_dht_transaction_t));
|
*transaction = t = ks_pool_alloc(pool, sizeof(ks_dht_transaction_t));
|
||||||
if (!t) {
|
ks_assert(t);
|
||||||
ret = KS_STATUS_NO_MEM;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
t->pool = pool;
|
|
||||||
|
|
||||||
|
t->pool = pool;
|
||||||
t->raddr = *raddr;
|
t->raddr = *raddr;
|
||||||
t->transactionid = transactionid;
|
t->transactionid = transactionid;
|
||||||
t->callback = callback;
|
t->callback = callback;
|
||||||
t->expiration = ks_time_now_sec() + KS_DHT_TRANSACTION_EXPIRATION_DELAY;
|
t->expiration = ks_time_now() + (KS_DHT_TRANSACTION_EXPIRATION * 1000);
|
||||||
|
|
||||||
done:
|
// done:
|
||||||
if (ret != KS_STATUS_SUCCESS) {
|
if (ret != KS_STATUS_SUCCESS) {
|
||||||
if (t) ks_dht_transaction_destroy(&t);
|
if (t) ks_dht_transaction_destroy(&t);
|
||||||
*transaction = NULL;
|
*transaction = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user