aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-03-25 17:17:21 +0000
committerJulius Bünger <buenger@mytum.de>2015-03-25 17:17:21 +0000
commitd5f60aed0f0a685ed664de342f88fb5883bcb648 (patch)
treefb86b09d73b56f02e06b09d5fa57a27c1230b637 /src
parentc18be283dc4b5d1e2381fc0b665f16b0e88b1934 (diff)
downloadgnunet-d5f60aed0f0a685ed664de342f88fb5883bcb648.tar.gz
gnunet-d5f60aed0f0a685ed664de342f88fb5883bcb648.zip
-small fixes, logging
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 5911bb93e..b5333ae28 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -670,7 +670,7 @@ peer_is_live (struct PeerContext *peer_ctx)
670 670
671 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %s is live\n", GNUNET_i2s (peer)); 671 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %s is live\n", GNUNET_i2s (peer));
672 672
673 if (0 != peer_ctx->num_outstanding_ops) 673 if (0 < peer_ctx->num_outstanding_ops)
674 { /* Call outstanding operations */ 674 { /* Call outstanding operations */
675 unsigned int i; 675 unsigned int i;
676 676
@@ -693,12 +693,23 @@ cadet_ntfy_tmt_rdy_cb (void *cls, size_t size, void *buf)
693{ 693{
694 struct PeerContext *peer_ctx = (struct PeerContext *) cls; 694 struct PeerContext *peer_ctx = (struct PeerContext *) cls;
695 695
696 peer_ctx->is_live_task = NULL;
697 LOG (GNUNET_ERROR_TYPE_DEBUG,
698 "Set ->is_live_task = NULL for peer %s\n",
699 GNUNET_i2s (&peer_ctx->peer_id));
700
696 if (NULL != buf 701 if (NULL != buf
697 && 0 != size) 702 && 0 != size)
698 { 703 {
699 peer_ctx->is_live_task = NULL;
700 peer_is_live (peer_ctx); 704 peer_is_live (peer_ctx);
701 } 705 }
706 else
707 {
708 LOG (GNUNET_ERROR_TYPE_WARNING,
709 "Problems establishing a connection to peer %s in order to check liveliness\n",
710 GNUNET_i2s (&peer_ctx->peer_id));
711 // TODO reschedule? cleanup?
712 }
702 713
703 //if (NULL != peer_ctx->is_live_task) 714 //if (NULL != peer_ctx->is_live_task)
704 //{ 715 //{
@@ -785,14 +796,21 @@ check_peer_live (struct PeerContext *peer_ctx)
785 LOG (GNUNET_ERROR_TYPE_DEBUG, 796 LOG (GNUNET_ERROR_TYPE_DEBUG,
786 "Get informed about peer %s getting live\n", 797 "Get informed about peer %s getting live\n",
787 GNUNET_i2s (&peer_ctx->peer_id)); 798 GNUNET_i2s (&peer_ctx->peer_id));
788 peer_ctx->is_live_task = 799 if (NULL == peer_ctx->is_live_task)
789 GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel, 800 {
790 GNUNET_NO, 801 peer_ctx->is_live_task =
791 GNUNET_TIME_UNIT_FOREVER_REL, 802 GNUNET_CADET_notify_transmit_ready (peer_ctx->send_channel,
792 sizeof (struct GNUNET_MessageHeader), 803 GNUNET_NO,
793 cadet_ntfy_tmt_rdy_cb, 804 GNUNET_TIME_UNIT_FOREVER_REL,
794 peer_ctx); 805 sizeof (struct GNUNET_MessageHeader),
795 // FIXME check whether this is NULL 806 cadet_ntfy_tmt_rdy_cb,
807 peer_ctx);
808 }
809 else
810 {
811 LOG (GNUNET_ERROR_TYPE_DEBUG,
812 "Already waiting for notification\n");
813 }
796} 814}
797 815
798 816
@@ -904,7 +922,7 @@ insert_in_sampler_scheduled (const struct PeerContext *peer_ctx)
904{ 922{
905 unsigned int i; 923 unsigned int i;
906 924
907 for ( i = 0 ; i < peer_ctx->num_outstanding_ops ; i++ ) 925 for (i = 0 ; i < peer_ctx->num_outstanding_ops ; i++)
908 if (insert_in_sampler== peer_ctx->outstanding_ops[i].op) 926 if (insert_in_sampler== peer_ctx->outstanding_ops[i].op)
909 return GNUNET_YES; 927 return GNUNET_YES;
910 return GNUNET_NO; 928 return GNUNET_NO;
@@ -2068,8 +2086,6 @@ cleanup_channel (void *cls,
2068 (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER); 2086 (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER);
2069 // Guess simply casting isn't the nicest way... 2087 // Guess simply casting isn't the nicest way...
2070 // FIXME wait for cadet to change this function 2088 // FIXME wait for cadet to change this function
2071 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up channel to peer %s\n",
2072 GNUNET_i2s (peer));
2073 2089
2074 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) 2090 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
2075 { 2091 {
@@ -2080,15 +2096,24 @@ cleanup_channel (void *cls,
2080 2096
2081 if (channel == peer_ctx->send_channel) 2097 if (channel == peer_ctx->send_channel)
2082 { /* Peer probably went down */ 2098 { /* Peer probably went down */
2099 LOG (GNUNET_ERROR_TYPE_DEBUG,
2100 "Peer %s destroyed send channel - probably went down, cleaning up\n",
2101 GNUNET_i2s (peer));
2083 rem_from_list (&gossip_list, &gossip_list_size, peer); 2102 rem_from_list (&gossip_list, &gossip_list_size, peer);
2084 rem_from_list (&pending_pull_reply_list, &pending_pull_reply_list_size, peer); 2103 rem_from_list (&pending_pull_reply_list, &pending_pull_reply_list_size, peer);
2085 2104
2105 peer_ctx->send_channel = NULL;
2086 /* Somwewhat {ab,re}use the iterator function */ 2106 /* Somwewhat {ab,re}use the iterator function */
2087 /* Cast to void is ok, because it's used as void in peer_remove_cb */ 2107 /* Cast to void is ok, because it's used as void in peer_remove_cb */
2088 (void) peer_remove_cb ((void *) channel, peer, peer_ctx); 2108 (void) peer_remove_cb ((void *) channel, peer, peer_ctx);
2089 } 2109 }
2090 else /* Other peer doesn't want to send us messages anymore */ 2110 else if (channel == peer_ctx->recv_channel)
2111 { /* Other peer doesn't want to send us messages anymore */
2112 LOG (GNUNET_ERROR_TYPE_DEBUG,
2113 "Peer %s destroyed recv channel - cleaning up channel\n",
2114 GNUNET_i2s (peer));
2091 peer_ctx->recv_channel = NULL; 2115 peer_ctx->recv_channel = NULL;
2116 }
2092 } 2117 }
2093} 2118}
2094 2119