diff options
author | Julius Bünger <buenger@mytum.de> | 2016-07-01 23:38:31 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2016-07-01 23:38:31 +0000 |
commit | c3c14c805a5994537391dd9e41c252cfcd9fb524 (patch) | |
tree | fb802ab25b5ff4114fe1bde7940bdbcb5e6fdb93 /src | |
parent | dc0f21a6720afedbd952886c256266f983faf7ac (diff) | |
download | gnunet-c3c14c805a5994537391dd9e41c252cfcd9fb524.tar.gz gnunet-c3c14c805a5994537391dd9e41c252cfcd9fb524.zip |
-rps _peers: restructure of status check
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-service-rps_peers.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c index aeef409aa..d52a6cfd5 100644 --- a/src/rps/gnunet-service-rps_peers.c +++ b/src/rps/gnunet-service-rps_peers.c | |||
@@ -509,6 +509,7 @@ get_channel (const struct GNUNET_PeerIdentity *peer) | |||
509 | GNUNET_RPS_CADET_PORT, | 509 | GNUNET_RPS_CADET_PORT, |
510 | GNUNET_CADET_OPTION_RELIABLE); | 510 | GNUNET_CADET_OPTION_RELIABLE); |
511 | } | 511 | } |
512 | GNUNET_assert (NULL != peer_ctx->send_channel); | ||
512 | return peer_ctx->send_channel; | 513 | return peer_ctx->send_channel; |
513 | } | 514 | } |
514 | 515 | ||
@@ -597,24 +598,32 @@ check_peer_live (struct PeerContext *peer_ctx) | |||
597 | "Get informed about peer %s getting live\n", | 598 | "Get informed about peer %s getting live\n", |
598 | GNUNET_i2s (&peer_ctx->peer_id)); | 599 | GNUNET_i2s (&peer_ctx->peer_id)); |
599 | 600 | ||
600 | if (NULL == peer_ctx->transmit_handle && | 601 | if (NULL != peer_ctx->transmit_handle) |
601 | NULL == peer_ctx->send_channel) | ||
602 | { | 602 | { |
603 | (void) get_channel (&peer_ctx->peer_id); | ||
604 | peer_ctx->transmit_handle = | ||
605 | GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel, | ||
606 | GNUNET_NO, | ||
607 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
608 | sizeof (struct GNUNET_MessageHeader), | ||
609 | cadet_notify_transmit_ready_cb, | ||
610 | peer_ctx); | ||
611 | } | ||
612 | else if (NULL != peer_ctx->transmit_handle) | ||
613 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 603 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
614 | "Already waiting for notification\n"); | 604 | "Already waiting for notification\n"); |
615 | else if (NULL != peer_ctx->send_channel) | 605 | return; |
606 | } | ||
607 | if (NULL != peer_ctx->send_channel) | ||
608 | { | ||
616 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 609 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
617 | "Already have established channel to peer\n"); | 610 | "Already have established channel to peer\n"); |
611 | return; | ||
612 | } | ||
613 | (void) get_channel (&peer_ctx->peer_id); | ||
614 | peer_ctx->transmit_handle = | ||
615 | GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel, | ||
616 | GNUNET_NO, | ||
617 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
618 | sizeof (struct GNUNET_MessageHeader), | ||
619 | cadet_notify_transmit_ready_cb, | ||
620 | peer_ctx); | ||
621 | if (NULL == peer_ctx->transmit_handle) | ||
622 | { | ||
623 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
624 | "Cadet was not able to queue the request (insufficient memory)\n"); | ||
625 | GNUNET_break (0); | ||
626 | } | ||
618 | } | 627 | } |
619 | 628 | ||
620 | /** | 629 | /** |