[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 01/02: rps service: prevent multiple hashing of ca
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 01/02: rps service: prevent multiple hashing of cadet port |
Date: |
Wed, 20 Jun 2018 18:44:34 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
commit 186b4036d98eb4c75d2619bd7c6d72dce5247b34
Author: Julius Bünger <address@hidden>
AuthorDate: Wed Jun 20 17:34:22 2018 +0200
rps service: prevent multiple hashing of cadet port
---
src/rps/gnunet-service-rps.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 9e81330bd..8af95eda7 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -69,6 +69,12 @@ static struct GNUNET_STATISTICS_Handle *stats;
static struct GNUNET_PeerIdentity own_identity;
+/**
+ * @brief Port used for cadet.
+ *
+ * Don't compute multiple times through making it global
+ */
+static struct GNUNET_HashCode port;
/***********************************************************************
* Old gnunet-service-rps_peers.c
@@ -578,7 +584,6 @@ struct GNUNET_CADET_Channel *
get_channel (const struct GNUNET_PeerIdentity *peer)
{
struct PeerContext *peer_ctx;
- struct GNUNET_HashCode port;
struct GNUNET_PeerIdentity *ctx_peer;
/* There exists a copy-paste-clone in run() */
struct GNUNET_MQ_MessageHandler cadet_handlers[] = {
@@ -608,9 +613,6 @@ get_channel (const struct GNUNET_PeerIdentity *peer)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Trying to establish channel to peer %s\n",
GNUNET_i2s (peer));
- GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_RPS,
- strlen (GNUNET_APPLICATION_PORT_RPS),
- &port);
ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
*ctx_peer = *peer;
peer_ctx->send_channel =
@@ -4247,7 +4249,6 @@ run (void *cls,
struct GNUNET_SERVICE_Handle *service)
{
char* fn_valid_peers;
- struct GNUNET_HashCode port;
GNUNET_log_setup ("rps", GNUNET_error_type_to_string
(GNUNET_ERROR_TYPE_DEBUG), NULL);
cfg = c;
--
To stop receiving notification emails like this one, please contact
address@hidden