From 053d33cec3ee5b34f4a9ec0f60d779c9c3a81637 Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 3 Apr 2017 23:03:49 +0000 Subject: [PATCH] added debugging to dht_protocol --- routing/dht_protocol.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/routing/dht_protocol.c b/routing/dht_protocol.c index 0b40e24..d2e423f 100644 --- a/routing/dht_protocol.c +++ b/routing/dht_protocol.c @@ -120,6 +120,8 @@ int libp2p_routing_dht_handle_add_provider(struct SessionContext* session, struc struct Peerstore* peerstore, struct ProviderStore* providerstore, unsigned char** result_buffer, size_t* result_buffer_size) { int retVal = 0; struct Libp2pPeer *peer = NULL; + + libp2p_logger_debug("dht_protocol", "In add_provider\n"); //TODO: verify peer signature if (message->record != NULL && message->record->author != NULL && message->record->author_size > 0 @@ -138,9 +140,18 @@ int libp2p_routing_dht_handle_add_provider(struct SessionContext* session, struc goto exit; if (!libp2p_message_protobuf_encode(message, *result_buffer, *result_buffer_size, result_buffer_size)) goto exit; + libp2p_logger_debug("dht_protocol", "add_provider protobuf'd the message. Returning results.\n"); } retVal = 1; exit: + if (retVal != 1) { + if (*result_buffer != NULL) { + free(*result_buffer); + *result_buffer_size = 0; + *result_buffer = NULL; + } + libp2p_logger_error("dht_protocol", "add_provider returning false\n"); + } if (peer != NULL) libp2p_peer_free(peer); return retVal;