From a251e71a97d40342bada58d88c2234f3ba25c700 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Mon, 3 Mar 2014 20:46:34 -0500 Subject: [PATCH] Some small changes/fixes. Changed some timeouts and made cryptopacket_handle return correctly. --- toxcore/net_crypto.c | 4 ++-- toxcore/onion_client.c | 4 ++-- toxcore/onion_client.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 5c2691f3..16a6784f 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -376,8 +376,8 @@ static int cryptopacket_handle(void *object, IP_Port source, uint8_t *packet, ui if (!dht->c->cryptopackethandlers[number].function) return 1; - dht->c->cryptopackethandlers[number].function(dht->c->cryptopackethandlers[number].object, source, public_key, data, - len); + return dht->c->cryptopackethandlers[number].function(dht->c->cryptopackethandlers[number].object, source, public_key, + data, len); } else { /* If request is not for us, try routing it. */ int retval = route_packet(dht, packet + 1, packet, length); diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index cc147828..64fdae35 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -806,7 +806,7 @@ int onion_set_friend_online(Onion_Client *onion_c, int friend_num, uint8_t is_on } -#define ANNOUNCE_FRIEND 30 +#define ANNOUNCE_FRIEND ONION_NODE_PING_INTERVAL static void do_friend(Onion_Client *onion_c, uint16_t friendnum) { @@ -882,7 +882,7 @@ void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_ha } #define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 7 -#define ANNOUNCE_INTERVAL_ANNOUNCED 30 +#define ANNOUNCE_INTERVAL_ANNOUNCED ONION_NODE_PING_INTERVAL static void do_announce(Onion_Client *onion_c) { diff --git a/toxcore/onion_client.h b/toxcore/onion_client.h index ae3e7ea3..684c03cc 100644 --- a/toxcore/onion_client.h +++ b/toxcore/onion_client.h @@ -27,7 +27,8 @@ #include "onion_announce.h" #define MAX_ONION_CLIENTS 8 -#define ONION_NODE_TIMEOUT 240 +#define ONION_NODE_PING_INTERVAL 30 +#define ONION_NODE_TIMEOUT (ONION_NODE_PING_INTERVAL * 4) /* The interval in seconds at which to tell our friends where we are */ #define ONION_FAKEID_INTERVAL 30