diff options
author | Julius Bünger <buenger@mytum.de> | 2018-06-20 17:34:22 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-06-20 17:34:22 +0200 |
commit | 186b4036d98eb4c75d2619bd7c6d72dce5247b34 (patch) | |
tree | eac40abaf929383a91429152ef3ea66728d5bdc2 /src | |
parent | 7bcf12f2a264a49f8a8125de48669af734846f4d (diff) | |
download | gnunet-186b4036d98eb4c75d2619bd7c6d72dce5247b34.tar.gz gnunet-186b4036d98eb4c75d2619bd7c6d72dce5247b34.zip |
rps service: prevent multiple hashing of cadet port
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 11 |
1 files 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; | |||
69 | static struct GNUNET_PeerIdentity own_identity; | 69 | static struct GNUNET_PeerIdentity own_identity; |
70 | 70 | ||
71 | 71 | ||
72 | /** | ||
73 | * @brief Port used for cadet. | ||
74 | * | ||
75 | * Don't compute multiple times through making it global | ||
76 | */ | ||
77 | static struct GNUNET_HashCode port; | ||
72 | 78 | ||
73 | /*********************************************************************** | 79 | /*********************************************************************** |
74 | * Old gnunet-service-rps_peers.c | 80 | * Old gnunet-service-rps_peers.c |
@@ -578,7 +584,6 @@ struct GNUNET_CADET_Channel * | |||
578 | get_channel (const struct GNUNET_PeerIdentity *peer) | 584 | get_channel (const struct GNUNET_PeerIdentity *peer) |
579 | { | 585 | { |
580 | struct PeerContext *peer_ctx; | 586 | struct PeerContext *peer_ctx; |
581 | struct GNUNET_HashCode port; | ||
582 | struct GNUNET_PeerIdentity *ctx_peer; | 587 | struct GNUNET_PeerIdentity *ctx_peer; |
583 | /* There exists a copy-paste-clone in run() */ | 588 | /* There exists a copy-paste-clone in run() */ |
584 | struct GNUNET_MQ_MessageHandler cadet_handlers[] = { | 589 | struct GNUNET_MQ_MessageHandler cadet_handlers[] = { |
@@ -608,9 +613,6 @@ get_channel (const struct GNUNET_PeerIdentity *peer) | |||
608 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 613 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
609 | "Trying to establish channel to peer %s\n", | 614 | "Trying to establish channel to peer %s\n", |
610 | GNUNET_i2s (peer)); | 615 | GNUNET_i2s (peer)); |
611 | GNUNET_CRYPTO_hash (GNUNET_APPLICATION_PORT_RPS, | ||
612 | strlen (GNUNET_APPLICATION_PORT_RPS), | ||
613 | &port); | ||
614 | ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); | 616 | ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); |
615 | *ctx_peer = *peer; | 617 | *ctx_peer = *peer; |
616 | peer_ctx->send_channel = | 618 | peer_ctx->send_channel = |
@@ -4247,7 +4249,6 @@ run (void *cls, | |||
4247 | struct GNUNET_SERVICE_Handle *service) | 4249 | struct GNUNET_SERVICE_Handle *service) |
4248 | { | 4250 | { |
4249 | char* fn_valid_peers; | 4251 | char* fn_valid_peers; |
4250 | struct GNUNET_HashCode port; | ||
4251 | 4252 | ||
4252 | GNUNET_log_setup ("rps", GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_DEBUG), NULL); | 4253 | GNUNET_log_setup ("rps", GNUNET_error_type_to_string (GNUNET_ERROR_TYPE_DEBUG), NULL); |
4253 | cfg = c; | 4254 | cfg = c; |