aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-06 20:24:48 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-06 20:24:48 +0000
commitcde214abca5b579930d25dcbf0e95b9062a9a8ea (patch)
tree728dde8d907dc00aa62bcf595f2673ee6c937411 /src/mesh/gnunet-service-mesh.c
parenteb20932094a00abfdef0694d304c17fdf1ca922a (diff)
downloadgnunet-cde214abca5b579930d25dcbf0e95b9062a9a8ea.tar.gz
gnunet-cde214abca5b579930d25dcbf0e95b9062a9a8ea.zip
Added debug info in service
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index ba0244881..c9ac99708 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -165,7 +165,7 @@ struct MeshPeerInfo
165 struct MeshTunnel **tunnels; 165 struct MeshTunnel **tunnels;
166 166
167 /** 167 /**
168 * Number of tunnels above 168 * Number of tunnels this peers participates in
169 */ 169 */
170 unsigned int ntunnels; 170 unsigned int ntunnels;
171}; 171};
@@ -889,9 +889,12 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
889 } 889 }
890 else 890 else
891 { 891 {
892 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
893 "MESH: Adding from GET: %s.\n",
894 GNUNET_i2s(&get_path[i]));
892 p->length++; 895 p->length++;
893 p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length); 896 p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length);
894 p->peers[p->length] = id; 897 p->peers[p->length - 1] = id;
895 } 898 }
896 } 899 }
897 i = put_path_length; 900 i = put_path_length;
@@ -914,9 +917,12 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
914 } 917 }
915 else 918 else
916 { 919 {
920 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
921 "MESH: Adding from PUT: %s.\n",
922 GNUNET_i2s(&put_path[i]));
917 p->length++; 923 p->length++;
918 p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length); 924 p->peers = GNUNET_realloc (p->peers, sizeof (GNUNET_PEER_Id) * p->length);
919 p->peers[p->length] = id; 925 p->peers[p->length - 1] = id;
920 } 926 }
921 } 927 }
922#if MESH_DEBUG 928#if MESH_DEBUG
@@ -929,6 +935,16 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
929 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 935 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
930 "MESH: In total: %d hops\n", 936 "MESH: In total: %d hops\n",
931 p->length); 937 p->length);
938 for (i = 0; i < p->length; i++)
939 {
940 struct GNUNET_PeerIdentity peer_id;
941
942 GNUNET_PEER_resolve(p->peers[i], &peer_id);
943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
944 "MESH: %u: %s\n",
945 p->peers[i],
946 GNUNET_h2s_full(&peer_id.hashPubKey));
947 }
932#endif 948#endif
933 return p; 949 return p;
934} 950}
@@ -1070,6 +1086,7 @@ notify_peer_disconnected (const struct MeshTunnelTreeNode *n)
1070/** 1086/**
1071 * Add a peer to a tunnel, accomodating paths accordingly and initializing all 1087 * Add a peer to a tunnel, accomodating paths accordingly and initializing all
1072 * needed rescources. 1088 * needed rescources.
1089 * If peer already exists, do nothing.
1073 * 1090 *
1074 * @param t Tunnel we want to add a new peer to 1091 * @param t Tunnel we want to add a new peer to
1075 * @param peer PeerInfo of the peer being added 1092 * @param peer PeerInfo of the peer being added
@@ -1112,7 +1129,6 @@ tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer)
1112 if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task) 1129 if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task)
1113 t->path_refresh_task = 1130 t->path_refresh_task =
1114 GNUNET_SCHEDULER_add_delayed (t->tree->refresh, &path_refresh, t); 1131 GNUNET_SCHEDULER_add_delayed (t->tree->refresh, &path_refresh, t);
1115
1116} 1132}
1117 1133
1118 1134