aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-10-31 17:42:05 +0000
committerBart Polot <bart@net.in.tum.de>2011-10-31 17:42:05 +0000
commitcd885f7b532d11a9de8dcbb2ca4fb007e4e53643 (patch)
tree2d4aba55969004ee9a7ae2029eecc3bd3a6d2876 /src/mesh
parent1c468a36db041ad0c0bb0aaf6750f4a6df30d84a (diff)
downloadgnunet-cd885f7b532d11a9de8dcbb2ca4fb007e4e53643.tar.gz
gnunet-cd885f7b532d11a9de8dcbb2ca4fb007e4e53643.zip
Don't try to send traffic to a peer that is not connected to us
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/gnunet-service-mesh.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 9b76e6b1e..0a481d6e9 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -445,6 +445,11 @@ static struct GNUNET_CONTAINER_MultiHashMap *peers;
445static struct GNUNET_CORE_Handle *core_handle; 445static struct GNUNET_CORE_Handle *core_handle;
446 446
447/** 447/**
448 * Handle to communicate with transport
449 */
450// static struct GNUNET_TRANSPORT_Handle *transport_handle;
451
452/**
448 * Handle to use DHT 453 * Handle to use DHT
449 */ 454 */
450static struct GNUNET_DHT_Handle *dht_handle; 455static struct GNUNET_DHT_Handle *dht_handle;
@@ -1139,14 +1144,29 @@ send_message (const struct GNUNET_MessageHeader *message,
1139{ 1144{
1140 struct MeshDataDescriptor *info; 1145 struct MeshDataDescriptor *info;
1141 struct MeshPeerInfo *neighbor; 1146 struct MeshPeerInfo *neighbor;
1147 struct MeshPeerPath *p;
1142 unsigned int i; 1148 unsigned int i;
1143 size_t size; 1149 size_t size;
1144 1150
1151// GNUNET_TRANSPORT_try_connect();
1152
1145 size = ntohs (message->size); 1153 size = ntohs (message->size);
1146 info = GNUNET_malloc (sizeof (struct MeshDataDescriptor)); 1154 info = GNUNET_malloc (sizeof (struct MeshDataDescriptor));
1147 info->data = GNUNET_malloc (size); 1155 info->data = GNUNET_malloc (size);
1148 memcpy (info->data, message, size); 1156 memcpy (info->data, message, size);
1149 neighbor = peer_info_get (peer); 1157 neighbor = peer_info_get (peer);
1158 for (p = neighbor->path_head; NULL != p; p = p->next)
1159 {
1160 if (2 == p->length)
1161 {
1162 break;
1163 }
1164 }
1165 if (NULL == p)
1166 {
1167 GNUNET_break (0);
1168 return;
1169 }
1150 i = peer_info_transmit_slot (neighbor); 1170 i = peer_info_transmit_slot (neighbor);
1151 info->handler_n = i; 1171 info->handler_n = i;
1152 info->peer = neighbor; 1172 info->peer = neighbor;
@@ -4328,6 +4348,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
4328 NULL, /* Don't notify about all outbound messages */ 4348 NULL, /* Don't notify about all outbound messages */
4329 GNUNET_NO, /* For header-only out notification */ 4349 GNUNET_NO, /* For header-only out notification */
4330 core_handlers); /* Register these handlers */ 4350 core_handlers); /* Register these handlers */
4351
4331 if (core_handle == NULL) 4352 if (core_handle == NULL)
4332 { 4353 {
4333 GNUNET_break (0); 4354 GNUNET_break (0);
@@ -4359,6 +4380,13 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
4359 &my_full_id.hashPubKey); 4380 &my_full_id.hashPubKey);
4360 myid = GNUNET_PEER_intern (&my_full_id); 4381 myid = GNUNET_PEER_intern (&my_full_id);
4361 4382
4383// // transport_handle = GNUNET_TRANSPORT_connect(c,
4384// // &my_full_id,
4385// // NULL,
4386// // NULL,
4387// // NULL,
4388// // NULL);
4389
4362 dht_handle = GNUNET_DHT_connect (c, 64); 4390 dht_handle = GNUNET_DHT_connect (c, 64);
4363 if (dht_handle == NULL) 4391 if (dht_handle == NULL)
4364 { 4392 {