diff options
author | Julius Bünger <buenger@mytum.de> | 2014-12-27 12:31:55 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2014-12-27 12:31:55 +0000 |
commit | 19751a8f13c002deab6864fbf21667708374f37c (patch) | |
tree | 6071e33bf577cd83e094afbbcd8356874cc9c153 /src/rps | |
parent | 6a6f9ec0c736ff14100f32c29ede9f2fd112b058 (diff) | |
download | gnunet-19751a8f13c002deab6864fbf21667708374f37c.tar.gz gnunet-19751a8f13c002deab6864fbf21667708374f37c.zip |
using get_peer_context()
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 6a38699af..0a334a838 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1351,26 +1351,27 @@ handle_inbound_channel (void *cls, | |||
1351 | uint32_t port, | 1351 | uint32_t port, |
1352 | enum GNUNET_CADET_ChannelOption options) | 1352 | enum GNUNET_CADET_ChannelOption options) |
1353 | { | 1353 | { |
1354 | struct peer_context *ctx; | ||
1355 | |||
1354 | LOG(GNUNET_ERROR_TYPE_DEBUG, "New channel was established to us (Peer %s).\n", GNUNET_i2s(initiator)); | 1356 | LOG(GNUNET_ERROR_TYPE_DEBUG, "New channel was established to us (Peer %s).\n", GNUNET_i2s(initiator)); |
1355 | 1357 | ||
1356 | GNUNET_assert( NULL != channel ); | 1358 | GNUNET_assert( NULL != channel ); |
1357 | 1359 | ||
1358 | // TODO we might not even store the from_channel | 1360 | // we might not even store the from_channel |
1359 | 1361 | ||
1360 | if ( GNUNET_CONTAINER_multipeermap_contains( peer_map, initiator ) ) { | 1362 | ctx = get_peer_ctx(peer_map, initiator); |
1361 | ((struct peer_context *) GNUNET_CONTAINER_multipeermap_get( peer_map, initiator ))->from_channel = channel; | 1363 | if (NULL != ctx->from_channel) |
1362 | // FIXME there might already be an established channel | 1364 | { |
1363 | } else { | ||
1364 | struct peer_context *ctx; | ||
1365 | |||
1366 | ctx = GNUNET_new(struct peer_context); | ||
1367 | ctx->in_flags = in_other_gossip_list; | ||
1368 | ctx->mq = NULL; // TODO create mq? | ||
1369 | ctx->from_channel = channel; | 1365 | ctx->from_channel = channel; |
1370 | |||
1371 | GNUNET_CONTAINER_multipeermap_put (peer_map, initiator, ctx, | ||
1372 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
1373 | } | 1366 | } |
1367 | |||
1368 | // FIXME there might already be an established channel | ||
1369 | |||
1370 | //ctx->in_flags = in_other_gossip_list; | ||
1371 | ctx->mq = NULL; // TODO create mq? | ||
1372 | |||
1373 | GNUNET_CONTAINER_multipeermap_put (peer_map, initiator, ctx, | ||
1374 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); | ||
1374 | return NULL; // TODO | 1375 | return NULL; // TODO |
1375 | } | 1376 | } |
1376 | 1377 | ||