aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-05-14 11:31:32 +0000
committerBart Polot <bart@net.in.tum.de>2013-05-14 11:31:32 +0000
commitd893c85d587e6f1def7b8e335143ea06ce53f4c5 (patch)
treefe7d8724fbcd2adf4a71313b35ff157e063ca6f2
parentf170603c10d85d55e723b4c3692ca126cb296281 (diff)
downloadgnunet-d893c85d587e6f1def7b8e335143ea06ce53f4c5.tar.gz
gnunet-d893c85d587e6f1def7b8e335143ea06ce53f4c5.zip
- fixes
-rw-r--r--src/mesh/gnunet-service-mesh-new.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index a79327278..1eb76232a 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -2132,7 +2132,7 @@ peer_cancel_queues (GNUNET_PEER_Id neighbor, struct MeshTunnel *t)
2132 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == pq->type || 2132 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == pq->type ||
2133 GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == pq->type) 2133 GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == pq->type)
2134 { 2134 {
2135 // Should have been removed on destroy children 2135 /* Should have been removed on destroy children */
2136 GNUNET_break (0); 2136 GNUNET_break (0);
2137 } 2137 }
2138 queue_destroy (pq, GNUNET_YES); 2138 queue_destroy (pq, GNUNET_YES);
@@ -2831,7 +2831,7 @@ queue_add (void *cls, uint16_t type, size_t size,
2831 GNUNET_STATISTICS_update(stats, 2831 GNUNET_STATISTICS_update(stats,
2832 "# messages dropped (buffer full)", 2832 "# messages dropped (buffer full)",
2833 1, GNUNET_NO); 2833 1, GNUNET_NO);
2834 return; // Drop message 2834 return; /* Drop message */
2835 } 2835 }
2836 (*n)++; 2836 (*n)++;
2837 } 2837 }
@@ -2920,7 +2920,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2920 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2920 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2921 " path is for tunnel %s [%X].\n", GNUNET_i2s (pi), tid); 2921 " path is for tunnel %s [%X].\n", GNUNET_i2s (pi), tid);
2922 t = tunnel_get (pi, tid); 2922 t = tunnel_get (pi, tid);
2923 if (NULL == t) // FIXME only for INCOMING tunnels? 2923 if (NULL == t)
2924 { 2924 {
2925 uint32_t opt; 2925 uint32_t opt;
2926 2926
@@ -2928,7 +2928,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2928 t = tunnel_new (GNUNET_PEER_intern (pi), tid, NULL, 0); 2928 t = tunnel_new (GNUNET_PEER_intern (pi), tid, NULL, 0);
2929 if (NULL == t) 2929 if (NULL == t)
2930 { 2930 {
2931 // FIXME notify failure 2931 GNUNET_break (0);
2932 return GNUNET_OK; 2932 return GNUNET_OK;
2933 } 2933 }
2934 opt = ntohl (msg->opt); 2934 opt = ntohl (msg->opt);
@@ -2944,13 +2944,6 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
2944 t->queue_max = 1; 2944 t->queue_max = 1;
2945 } 2945 }
2946 2946
2947 // FIXME only assign a local tid if a local client is interested (on demand)
2948 while (NULL != tunnel_get_incoming (next_local_tid))
2949 next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
2950 t->local_tid_dest = next_local_tid++;
2951 next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
2952 // FIXME end
2953
2954 tunnel_reset_timeout (t); 2947 tunnel_reset_timeout (t);
2955 GMC_hash32 (t->local_tid_dest, &hash); 2948 GMC_hash32 (t->local_tid_dest, &hash);
2956 if (GNUNET_OK != 2949 if (GNUNET_OK !=
@@ -3011,9 +3004,16 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
3011 if (own_pos == size - 1) 3004 if (own_pos == size - 1)
3012 { 3005 {
3013 /* It is for us! Send ack. */ 3006 /* It is for us! Send ack. */
3007 // TODO: check port number / client registration
3014 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); 3008 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n");
3015 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); 3009 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO);
3016 t->dest = myid; 3010 t->dest = myid;
3011
3012 while (NULL != tunnel_get_incoming (next_local_tid))
3013 next_local_tid = (next_local_tid + 1) | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
3014 t->local_tid_dest = next_local_tid++;
3015 next_local_tid = next_local_tid | GNUNET_MESH_LOCAL_TUNNEL_ID_SERV;
3016
3017 send_path_ack (t); 3017 send_path_ack (t);
3018 } 3018 }
3019 else 3019 else
@@ -3051,7 +3051,6 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
3051{ 3051{
3052 struct GNUNET_MESH_ManipulatePath *msg; 3052 struct GNUNET_MESH_ManipulatePath *msg;
3053 struct GNUNET_PeerIdentity *pi; 3053 struct GNUNET_PeerIdentity *pi;
3054 struct MeshPeerPath *path;
3055 struct MeshTunnel *t; 3054 struct MeshTunnel *t;
3056 unsigned int own_pos; 3055 unsigned int own_pos;
3057 unsigned int i; 3056 unsigned int i;
@@ -3092,25 +3091,19 @@ handle_mesh_path_destroy (void *cls, const struct GNUNET_PeerIdentity *peer,
3092 GNUNET_break_op (0); 3091 GNUNET_break_op (0);
3093 return GNUNET_OK; 3092 return GNUNET_OK;
3094 } 3093 }
3095 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Creating path...\n");
3096 path = path_new (size);
3097 own_pos = 0; 3094 own_pos = 0;
3098 for (i = 0; i < size; i++) 3095 for (i = 0; i < size; i++)
3099 { 3096 {
3100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ... adding %s\n", 3097 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u: %s\n", i, GNUNET_i2s (&pi[i]));
3101 GNUNET_i2s (&pi[i])); 3098 if (GNUNET_PEER_search (&pi[i]) == myid)
3102 path->peers[i] = GNUNET_PEER_intern (&pi[i]);
3103 if (path->peers[i] == myid)
3104 own_pos = i; 3099 own_pos = i;
3105 } 3100 }
3106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos); 3101 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
3107 if (own_pos < path->length - 1) 3102 if (own_pos < size - 1)
3108 send_prebuilt_message (message, path->peers[own_pos + 1], t); 3103 send_prebuilt_message (message, t->next_hop, t);
3109 else 3104 else
3110 send_client_tunnel_destroy (t); 3105 send_client_tunnel_destroy (t);
3111 3106
3112// tunnel_delete_peer (t, path->peers[path->length - 1]); FIXME
3113 path_destroy (path);
3114 return GNUNET_OK; 3107 return GNUNET_OK;
3115} 3108}
3116 3109
@@ -3515,6 +3508,7 @@ handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
3515{ 3508{
3516 struct GNUNET_MESH_Poll *msg; 3509 struct GNUNET_MESH_Poll *msg;
3517 struct MeshTunnel *t; 3510 struct MeshTunnel *t;
3511 GNUNET_PEER_Id id;
3518 3512
3519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an POLL packet from %s!\n", 3513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got an POLL packet from %s!\n",
3520 GNUNET_i2s (peer)); 3514 GNUNET_i2s (peer));
@@ -3532,17 +3526,19 @@ handle_mesh_poll (void *cls, const struct GNUNET_PeerIdentity *peer,
3532 } 3526 }
3533 3527
3534 /* Is this a forward or backward ACK? */ 3528 /* Is this a forward or backward ACK? */
3535 if (t->prev_hop != GNUNET_PEER_search(peer)) 3529 id = GNUNET_PEER_search(peer);
3530 if (t->next_hop == id)
3536 { 3531 {
3537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n"); 3532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from FWD\n");
3538 /* FIXME cinfo->bck_ack = cinfo->fwd_pid; // mark as ready to send */
3539 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); 3533 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3540 } 3534 }
3541 else 3535 else if (t->prev_hop == id)
3542 { 3536 {
3543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from BCK\n"); 3537 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " from BCK\n");
3544 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL); 3538 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_POLL);
3545 } 3539 }
3540 else
3541 GNUNET_break (0);
3546 3542
3547 return GNUNET_OK; 3543 return GNUNET_OK;
3548} 3544}