aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-08-04 14:57:05 +0000
committerBart Polot <bart@net.in.tum.de>2011-08-04 14:57:05 +0000
commitceb6ebc2337fff55f9e01e4e3c5470684ce2319a (patch)
tree44bbcf65cb4ae357419d347064d77e2a90725a3f /src/mesh/gnunet-service-mesh.c
parentfbec33e263a3ef62a0c0b56051795d452c4f0eb6 (diff)
downloadgnunet-ceb6ebc2337fff55f9e01e4e3c5470684ce2319a.tar.gz
gnunet-ceb6ebc2337fff55f9e01e4e3c5470684ce2319a.zip
Fixed message retransmission
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r--src/mesh/gnunet-service-mesh.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index df521f441..02a78244f 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -967,6 +967,7 @@ send_core_data_raw (void *cls, size_t size, void *buf)
967 return 0; 967 return 0;
968 } 968 }
969 memcpy(buf, msg, total_size); 969 memcpy(buf, msg, total_size);
970 GNUNET_free(cls);
970 return total_size; 971 return total_size;
971} 972}
972 973
@@ -1271,6 +1272,8 @@ handle_mesh_data_unicast (void *cls,
1271 return GNUNET_OK; 1272 return GNUNET_OK;
1272 } 1273 }
1273 GNUNET_PEER_resolve(get_first_hop(pi->path), &id); 1274 GNUNET_PEER_resolve(get_first_hop(pi->path), &id);
1275 msg = GNUNET_malloc(size);
1276 memcpy(msg, message, size);
1274 GNUNET_CORE_notify_transmit_ready(core_handle, 1277 GNUNET_CORE_notify_transmit_ready(core_handle,
1275 0, 1278 0,
1276 0, 1279 0,
@@ -1402,34 +1405,37 @@ handle_mesh_data_to_orig (void *cls,
1402 + sizeof(struct GNUNET_MessageHeader)) 1405 + sizeof(struct GNUNET_MessageHeader))
1403 { 1406 {
1404 GNUNET_break_op (0); 1407 GNUNET_break_op (0);
1405 return GNUNET_OK; // FIXME maybe SYSERR? peer misbehaving? 1408 return GNUNET_OK;
1406 } 1409 }
1407 msg = (struct GNUNET_MESH_DataMessageToOrigin *) message; 1410 msg = (struct GNUNET_MESH_DataMessageToOrigin *) message;
1408 t = retrieve_tunnel(&msg->oid, ntohl(msg->tid)); 1411 t = retrieve_tunnel(&msg->oid, ntohl(msg->tid));
1409 1412
1410 if (NULL == t) { 1413 if (NULL == t) {
1411 /* TODO: are we so nice that we try to send it to OID anyway? We *could* 1414 /* TODO notify that we dont know this tunnel (whom)? */
1412 * know how to reach it, from the global peer hashmap
1413 */
1414 return GNUNET_OK; 1415 return GNUNET_OK;
1415 } 1416 }
1416 1417
1417 if (t->id.oid == myid) { 1418 if (t->id.oid == myid) {
1418 if (NULL == t->client) { 1419 if (NULL == t->client) {
1419 /* got data packet for ownerless tunnel */ 1420 /* got data packet for ownerless tunnel */
1420 GNUNET_break (0); 1421 GNUNET_break_op (0);
1421 return GNUNET_OK; 1422 return GNUNET_OK;
1422 } 1423 }
1423 // TODO retransmit to client owner 1424 GNUNET_SERVER_notification_context_unicast(nc,
1425 t->client->handle,
1426 message,
1427 GNUNET_YES);
1424 return GNUNET_OK; 1428 return GNUNET_OK;
1425 } 1429 }
1426 peer_info = get_peer_info(&msg->oid); 1430 peer_info = get_peer_info(&msg->oid);
1427 if (NULL == peer_info) { 1431 if (NULL == peer_info) {
1428 /* unknown origin of tunnel */ 1432 /* unknown origin of tunnel */
1429 GNUNET_break (0); 1433 GNUNET_break (0);
1430 return GNUNET_OK; 1434 return GNUNET_OK;
1431 } 1435 }
1432 GNUNET_PEER_resolve(get_first_hop(peer_info->path), &id); 1436 GNUNET_PEER_resolve(get_first_hop(peer_info->path), &id);
1437 msg = GNUNET_malloc(size);
1438 memcpy(msg, message, size);
1433 GNUNET_CORE_notify_transmit_ready(core_handle, 1439 GNUNET_CORE_notify_transmit_ready(core_handle,
1434 0, 1440 0,
1435 0, 1441 0,