From 2a7eb7cb6d8fcc01e3d06b7c2b107549ae8dab40 Mon Sep 17 00:00:00 2001 From: Julius Bünger Date: Fri, 13 Jul 2018 09:53:05 +0200 Subject: Revert "restructure rps service: start keeping track of channels" This reverts commit 330bb7242aed7c426cfdbb589155db5bb3fa83dc. --- src/rps/gnunet-service-rps.c | 55 +++++++------------------------------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 5d568dfac..12794945e 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -264,34 +264,6 @@ struct PeersIteratorCls void *cls; }; -/** - * @brief Context for a channel - */ -struct ChannelCtx -{ - /** - * @brief Meant to be used in a DLL - */ - struct ChannelCtx *next; - struct ChannelCtx *prev; - - /** - * @brief The channel itself - */ - struct GNUNET_CADET_Channel *channel; - - /** - * @brief The peer context associated with the channel - */ - struct PeerContext *peer_ctx; -}; - -/** - * @brief The DLL of channel contexts - */ -static struct ChannelCtx *channel_ctx_head; -static struct ChannelCtx *channel_ctx_tail; - /** * @brief Hashmap of valid peers. */ @@ -1549,7 +1521,6 @@ Peers_handle_inbound_channel (void *cls, { struct PeerContext *peer_ctx; struct GNUNET_PeerIdentity *ctx_peer; - struct ChannelCtx *channel_ctx; LOG (GNUNET_ERROR_TYPE_DEBUG, "New channel was established to us (Peer %s).\n", @@ -1560,10 +1531,6 @@ Peers_handle_inbound_channel (void *cls, set_peer_live (peer_ctx); ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); *ctx_peer = *initiator; - channel_ctx = GNUNET_new (struct ChannelCtx); - channel_ctx->peer_ctx = peer_ctx; - channel_ctx->channel = channel; - GNUNET_CONTAINER_DLL_insert (channel_ctx_head, channel_ctx_tail, channel_ctx); /* We only accept one incoming channel per peer */ if (GNUNET_YES == Peers_check_peer_send_intention (initiator)) { @@ -1576,10 +1543,10 @@ Peers_handle_inbound_channel (void *cls, GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); peer_ctx->recv_channel = channel; /* return the channel context */ - return channel_ctx; + return ctx_peer; } peer_ctx->recv_channel = channel; - return channel_ctx; + return ctx_peer; } @@ -1691,8 +1658,7 @@ void Peers_cleanup_destroyed_channel (void *cls, const struct GNUNET_CADET_Channel *channel) { - struct ChannelCtx *channel_ctx = cls; - const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; + struct GNUNET_PeerIdentity *peer = cls; struct PeerContext *peer_ctx; uint32_t *channel_flag; @@ -2704,8 +2670,7 @@ static void cleanup_destroyed_channel (void *cls, const struct GNUNET_CADET_Channel *channel) { - struct ChannelCtx *channel_ctx = cls; // FIXME: free this context! - struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; + struct GNUNET_PeerIdentity *peer = cls; uint32_t *channel_flag; struct PeerContext *peer_ctx; @@ -3198,8 +3163,7 @@ static void handle_peer_check (void *cls, const struct GNUNET_MessageHeader *msg) { - const struct ChannelCtx *channel_ctx = cls; - const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; + const struct GNUNET_PeerIdentity *peer = cls; LOG (GNUNET_ERROR_TYPE_DEBUG, "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); @@ -3219,8 +3183,7 @@ static void handle_peer_push (void *cls, const struct GNUNET_MessageHeader *msg) { - const struct ChannelCtx *channel_ctx = cls; - const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; + const struct GNUNET_PeerIdentity *peer = cls; // (check the proof of work (?)) @@ -3281,8 +3244,7 @@ static void handle_peer_pull_request (void *cls, const struct GNUNET_MessageHeader *msg) { - const struct ChannelCtx *channel_ctx = cls; - const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id; + struct GNUNET_PeerIdentity *peer = cls; const struct GNUNET_PeerIdentity *view_array; LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); @@ -3362,9 +3324,8 @@ static void handle_peer_pull_reply (void *cls, const struct GNUNET_RPS_P2P_PullReplyMessage *msg) { - const struct ChannelCtx *channel_ctx = cls; - const struct GNUNET_PeerIdentity *sender = &channel_ctx->peer_ctx->peer_id; const struct GNUNET_PeerIdentity *peers; + struct GNUNET_PeerIdentity *sender = cls; uint32_t i; #ifdef ENABLE_MALICIOUS struct AttackedPeer *tmp_att_peer; -- cgit v1.2.3