diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-05-07 13:07:33 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-05-07 13:07:33 +0000 |
commit | d9c88959e0bc6b817b609a816b4cb75f5e8c4c63 (patch) | |
tree | 0dc92874843848a47c0f21e1f919517797628691 /src | |
parent | bd4e10f6c1162adf47bbe60ef005cc42a635d5ad (diff) | |
download | gnunet-d9c88959e0bc6b817b609a816b4cb75f5e8c4c63.tar.gz gnunet-d9c88959e0bc6b817b609a816b4cb75f5e8c4c63.zip |
- wip
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-new.c | 317 | ||||
-rw-r--r-- | src/mesh/mesh2_protocol.h | 1 |
2 files changed, 21 insertions, 297 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c index 1691894e5..79cfd5655 100644 --- a/src/mesh/gnunet-service-mesh-new.c +++ b/src/mesh/gnunet-service-mesh-new.c | |||
@@ -419,13 +419,6 @@ struct MeshTunnel | |||
419 | int force_ack; | 419 | int force_ack; |
420 | 420 | ||
421 | /** | 421 | /** |
422 | * MeshTunnelChildInfo of all children, indexed by GNUNET_PEER_Id. | ||
423 | * Contains the Flow Control info: FWD ACK value received, | ||
424 | * last BCK ACK sent, PID and SKIP values. | ||
425 | */ | ||
426 | struct GNUNET_CONTAINER_MultiHashMap *children_fc; | ||
427 | |||
428 | /** | ||
429 | * Last ACK sent towards the origin (for traffic towards leaf node). | 422 | * Last ACK sent towards the origin (for traffic towards leaf node). |
430 | */ | 423 | */ |
431 | uint32_t last_fwd_ack; | 424 | uint32_t last_fwd_ack; |
@@ -2718,22 +2711,17 @@ tunnel_notify_client_peer_disconnected (void *cls, GNUNET_PEER_Id peer_id) | |||
2718 | static void | 2711 | static void |
2719 | tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer) | 2712 | tunnel_add_peer (struct MeshTunnel *t, struct MeshPeerInfo *peer) |
2720 | { | 2713 | { |
2721 | struct GNUNET_PeerIdentity id; | ||
2722 | struct MeshPeerPath *best_p; | 2714 | struct MeshPeerPath *best_p; |
2723 | struct MeshPeerPath *p; | 2715 | struct MeshPeerPath *p; |
2724 | unsigned int best_cost; | 2716 | unsigned int best_cost; |
2725 | unsigned int cost; | 2717 | unsigned int cost; |
2726 | 2718 | ||
2727 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tunnel_add_peer\n"); | 2719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tunnel_add_peer\n"); |
2728 | GNUNET_PEER_resolve (peer->id, &id); | 2720 | /* FIXME */ |
2729 | if (GNUNET_NO == | 2721 | if (t->peer != peer->id) |
2730 | GNUNET_CONTAINER_multihashmap_contains (t->peers, &id.hashPubKey)) | ||
2731 | { | 2722 | { |
2732 | GNUNET_array_append (peer->tunnels, peer->ntunnels, t); | 2723 | GNUNET_array_append (peer->tunnels, peer->ntunnels, t); |
2733 | GNUNET_assert (GNUNET_OK == | 2724 | t->peer = peer->id; |
2734 | GNUNET_CONTAINER_multihashmap_put (t->peers, &id.hashPubKey, | ||
2735 | peer, | ||
2736 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | ||
2737 | } | 2725 | } |
2738 | 2726 | ||
2739 | if (NULL != (p = peer->path_head)) | 2727 | if (NULL != (p = peer->path_head)) |
@@ -2860,192 +2848,6 @@ tunnel_notify_connection_broken (struct MeshTunnel *t, GNUNET_PEER_Id p1, | |||
2860 | 2848 | ||
2861 | 2849 | ||
2862 | /** | 2850 | /** |
2863 | * Send a multicast packet to a neighbor. | ||
2864 | * | ||
2865 | * @param cls Closure (Info about the multicast packet) | ||
2866 | * @param neighbor_id Short ID of the neighbor to send the packet to. | ||
2867 | */ | ||
2868 | static void | ||
2869 | tunnel_send_multicast_iterator (void *cls, GNUNET_PEER_Id neighbor_id) | ||
2870 | { | ||
2871 | struct MeshData *mdata = cls; | ||
2872 | struct MeshTransmissionDescriptor *info; | ||
2873 | struct GNUNET_PeerIdentity neighbor; | ||
2874 | struct GNUNET_MessageHeader *msg; | ||
2875 | |||
2876 | info = GNUNET_malloc (sizeof (struct MeshTransmissionDescriptor)); | ||
2877 | |||
2878 | info->mesh_data = mdata; | ||
2879 | (mdata->reference_counter) ++; | ||
2880 | info->destination = neighbor_id; | ||
2881 | GNUNET_PEER_resolve (neighbor_id, &neighbor); | ||
2882 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending to %s...\n", | ||
2883 | GNUNET_i2s (&neighbor)); | ||
2884 | info->peer = peer_info_get (&neighbor); | ||
2885 | GNUNET_assert (NULL != info->peer); | ||
2886 | msg = (struct GNUNET_MessageHeader *) mdata->data; | ||
2887 | queue_add(info, | ||
2888 | ntohs (msg->type), | ||
2889 | info->mesh_data->data_len, | ||
2890 | info->peer, | ||
2891 | mdata->t); | ||
2892 | } | ||
2893 | |||
2894 | |||
2895 | /** | ||
2896 | * Queue a message in a tunnel in multicast, sending a copy to each child node | ||
2897 | * down the local one in the tunnel tree. | ||
2898 | * | ||
2899 | * @param t Tunnel in which to send the data. | ||
2900 | * @param msg Message to be sent. | ||
2901 | */ | ||
2902 | static void | ||
2903 | tunnel_send_multicast (struct MeshTunnel *t, | ||
2904 | const struct GNUNET_MessageHeader *msg) | ||
2905 | { | ||
2906 | struct MeshData *mdata; | ||
2907 | |||
2908 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2909 | " sending a multicast packet...\n"); | ||
2910 | |||
2911 | mdata = GNUNET_malloc (sizeof (struct MeshData)); | ||
2912 | mdata->data_len = ntohs (msg->size); | ||
2913 | mdata->t = t; | ||
2914 | mdata->data = GNUNET_malloc (mdata->data_len); | ||
2915 | memcpy (mdata->data, msg, mdata->data_len); | ||
2916 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_MESH_MULTICAST) | ||
2917 | { | ||
2918 | struct GNUNET_MESH_Multicast *mcast; | ||
2919 | |||
2920 | mcast = (struct GNUNET_MESH_Multicast *) mdata->data; | ||
2921 | if (t->fwd_queue_n >= t->fwd_queue_max) | ||
2922 | { | ||
2923 | GNUNET_break (0); | ||
2924 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, " queue full!\n"); | ||
2925 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2926 | " message from %s!\n", | ||
2927 | GNUNET_i2s(&mcast->oid)); | ||
2928 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2929 | " message at %s!\n", | ||
2930 | GNUNET_i2s(&my_full_id)); | ||
2931 | GNUNET_free (mdata->data); | ||
2932 | GNUNET_free (mdata); | ||
2933 | return; | ||
2934 | } | ||
2935 | t->fwd_queue_n++; | ||
2936 | mcast->ttl = htonl (ntohl (mcast->ttl) - 1); | ||
2937 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " data packet, ttl: %u\n", | ||
2938 | ntohl (mcast->ttl)); | ||
2939 | } | ||
2940 | else | ||
2941 | { | ||
2942 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " not a data packet, no ttl\n"); | ||
2943 | } | ||
2944 | |||
2945 | tree_iterate_children (t->tree, &tunnel_send_multicast_iterator, mdata); | ||
2946 | if (mdata->reference_counter == 0) | ||
2947 | { | ||
2948 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2949 | " no one to send data to\n"); | ||
2950 | GNUNET_free (mdata->data); | ||
2951 | GNUNET_free (mdata); | ||
2952 | if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_MESH_MULTICAST) | ||
2953 | t->fwd_queue_n--; | ||
2954 | } | ||
2955 | else | ||
2956 | { | ||
2957 | mdata->total_out = mdata->reference_counter; | ||
2958 | } | ||
2959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2960 | " sending a multicast packet done\n"); | ||
2961 | return; | ||
2962 | } | ||
2963 | |||
2964 | |||
2965 | /** | ||
2966 | * Increase the SKIP value of all peers that | ||
2967 | * have not received a unicast message. | ||
2968 | * | ||
2969 | * @param cls Closure (ID of the peer that HAS received the message). | ||
2970 | * @param key ID of the neighbor. | ||
2971 | * @param value Information about the neighbor. | ||
2972 | * | ||
2973 | * @return GNUNET_YES to keep iterating. | ||
2974 | */ | ||
2975 | static int | ||
2976 | tunnel_add_skip (void *cls, | ||
2977 | const struct GNUNET_HashCode * key, | ||
2978 | void *value) | ||
2979 | { | ||
2980 | struct GNUNET_PeerIdentity *neighbor = cls; | ||
2981 | struct MeshTunnelChildInfo *cinfo = value; | ||
2982 | |||
2983 | /* TODO compare only pointers? key == neighbor? */ | ||
2984 | if (0 == memcmp (&neighbor->hashPubKey, key, sizeof (struct GNUNET_HashCode))) | ||
2985 | { | ||
2986 | return GNUNET_YES; | ||
2987 | } | ||
2988 | cinfo->skip++; | ||
2989 | return GNUNET_YES; | ||
2990 | } | ||
2991 | |||
2992 | |||
2993 | /** | ||
2994 | * @brief Get neighbor's Flow Control information. | ||
2995 | * | ||
2996 | * Retrieves the MeshTunnelChildInfo containing Flow Control data about a direct | ||
2997 | * descendant of the local node in a certain tunnel. | ||
2998 | * If the info is not yet there (recently created path), creates the data struct | ||
2999 | * and inserts it into the tunnel info, initialized to the current tunnel ACK | ||
3000 | * values. | ||
3001 | * | ||
3002 | * @param t Tunnel related. | ||
3003 | * @param peer Neighbor whose Flow Control info is needed. | ||
3004 | * | ||
3005 | * @return Neighbor's Flow Control info. | ||
3006 | */ | ||
3007 | static struct MeshTunnelChildInfo * | ||
3008 | tunnel_get_neighbor_fc (struct MeshTunnel *t, | ||
3009 | const struct GNUNET_PeerIdentity *peer) | ||
3010 | { | ||
3011 | struct MeshTunnelChildInfo *cinfo; | ||
3012 | |||
3013 | if (NULL == t->children_fc) | ||
3014 | return NULL; | ||
3015 | |||
3016 | cinfo = GNUNET_CONTAINER_multihashmap_get (t->children_fc, | ||
3017 | &peer->hashPubKey); | ||
3018 | if (NULL == cinfo) | ||
3019 | { | ||
3020 | uint32_t delta; | ||
3021 | |||
3022 | cinfo = GNUNET_malloc (sizeof (struct MeshTunnelChildInfo)); | ||
3023 | cinfo->id = GNUNET_PEER_intern (peer); | ||
3024 | cinfo->skip = t->fwd_pid; | ||
3025 | cinfo->t = t; | ||
3026 | |||
3027 | delta = t->nobuffer ? 1 : INITIAL_WINDOW_SIZE; | ||
3028 | cinfo->fwd_ack = t->fwd_pid + delta; | ||
3029 | cinfo->bck_ack = delta; | ||
3030 | cinfo->bck_pid = -1; | ||
3031 | |||
3032 | cinfo->fc_poll = GNUNET_SCHEDULER_NO_TASK; | ||
3033 | cinfo->fc_poll_time = GNUNET_TIME_UNIT_SECONDS; | ||
3034 | |||
3035 | cinfo->send_buffer = | ||
3036 | GNUNET_malloc (sizeof(struct MeshPeerQueue *) * t->fwd_queue_max); | ||
3037 | |||
3038 | GNUNET_assert (GNUNET_OK == | ||
3039 | GNUNET_CONTAINER_multihashmap_put (t->children_fc, | ||
3040 | &peer->hashPubKey, | ||
3041 | cinfo, | ||
3042 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | ||
3043 | } | ||
3044 | return cinfo; | ||
3045 | } | ||
3046 | |||
3047 | |||
3048 | /** | ||
3049 | * Get the Flow Control info of a client. | 2851 | * Get the Flow Control info of a client. |
3050 | * | 2852 | * |
3051 | * @param t Tunnel on which to look. | 2853 | * @param t Tunnel on which to look. |
@@ -3097,14 +2899,8 @@ tunnel_get_child_fwd_ack (void *cls, | |||
3097 | ctx->init = GNUNET_YES; | 2899 | ctx->init = GNUNET_YES; |
3098 | } | 2900 | } |
3099 | 2901 | ||
3100 | if (GNUNET_YES == t->speed_min) | 2902 | /* FIXME check */ |
3101 | { | 2903 | ctx->max_child_ack = ctx->max_child_ack > ack ? ctx->max_child_ack : ack; |
3102 | ctx->max_child_ack = ctx->max_child_ack > ack ? ack : ctx->max_child_ack; | ||
3103 | } | ||
3104 | else | ||
3105 | { | ||
3106 | ctx->max_child_ack = ctx->max_child_ack > ack ? ctx->max_child_ack : ack; | ||
3107 | } | ||
3108 | 2904 | ||
3109 | } | 2905 | } |
3110 | 2906 | ||
@@ -3192,10 +2988,7 @@ tunnel_get_clients_fwd_ack (struct MeshTunnel *t) | |||
3192 | for (ack = -1LL, i = 0; i < t->nclients; i++) | 2988 | for (ack = -1LL, i = 0; i < t->nclients; i++) |
3193 | { | 2989 | { |
3194 | if (-1LL == ack || | 2990 | if (-1LL == ack || |
3195 | (GNUNET_YES == t->speed_min && | 2991 | GNUNET_YES == GMC_is_pid_bigger (ack, t->clients_fc[i].fwd_ack)) |
3196 | GNUNET_YES == GMC_is_pid_bigger (ack, t->clients_fc[i].fwd_ack)) || | ||
3197 | (GNUNET_NO == t->speed_min && | ||
3198 | GNUNET_YES == GMC_is_pid_bigger (t->clients_fc[i].fwd_ack, ack))) | ||
3199 | { | 2992 | { |
3200 | ack = t->clients_fc[i].fwd_ack; | 2993 | ack = t->clients_fc[i].fwd_ack; |
3201 | } | 2994 | } |
@@ -3225,7 +3018,7 @@ tunnel_get_fwd_ack (struct MeshTunnel *t) | |||
3225 | int64_t child_ack; | 3018 | int64_t child_ack; |
3226 | int64_t client_ack; | 3019 | int64_t client_ack; |
3227 | 3020 | ||
3228 | count = t->fwd_pid - t->skip; | 3021 | count = t->fwd_pid; |
3229 | buffer_free = t->fwd_queue_max - t->fwd_queue_n; | 3022 | buffer_free = t->fwd_queue_max - t->fwd_queue_n; |
3230 | child_ack = tunnel_get_children_fwd_ack (t); | 3023 | child_ack = tunnel_get_children_fwd_ack (t); |
3231 | client_ack = tunnel_get_clients_fwd_ack (t); | 3024 | client_ack = tunnel_get_clients_fwd_ack (t); |
@@ -3259,16 +3052,10 @@ tunnel_get_fwd_ack (struct MeshTunnel *t) | |||
3259 | { | 3052 | { |
3260 | client_ack = ack; | 3053 | client_ack = ack; |
3261 | } | 3054 | } |
3262 | if (GNUNET_YES == t->speed_min) | 3055 | /* FIXME check */ |
3263 | { | 3056 | ack = GMC_max_pid ((uint32_t) child_ack, ack); |
3264 | ack = GMC_min_pid ((uint32_t) child_ack, ack); | 3057 | ack = GMC_max_pid ((uint32_t) client_ack, ack); |
3265 | ack = GMC_min_pid ((uint32_t) client_ack, ack); | 3058 | |
3266 | } | ||
3267 | else | ||
3268 | { | ||
3269 | ack = GMC_max_pid ((uint32_t) child_ack, ack); | ||
3270 | ack = GMC_max_pid ((uint32_t) client_ack, ack); | ||
3271 | } | ||
3272 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3059 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3273 | "c %u, bf %u, ch %lld, cl %lld, ACK: %u\n", | 3060 | "c %u, bf %u, ch %lld, cl %lld, ACK: %u\n", |
3274 | count, buffer_free, child_ack, client_ack, ack); | 3061 | count, buffer_free, child_ack, client_ack, ack); |
@@ -3670,11 +3457,10 @@ tunnel_send_destroy (struct MeshTunnel *t, GNUNET_PEER_Id parent) | |||
3670 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3457 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3671 | " sending tunnel destroy for tunnel: %s [%X]\n", | 3458 | " sending tunnel destroy for tunnel: %s [%X]\n", |
3672 | GNUNET_i2s (&msg.oid), t->id.tid); | 3459 | GNUNET_i2s (&msg.oid), t->id.tid); |
3673 | if (tree_count_children(t->tree) > 0) | 3460 | |
3674 | { | 3461 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending multicast to child\n"); |
3675 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending multicast to children\n"); | 3462 | /* FIXME tunnel_send_multicast (t, &msg.header); */ |
3676 | tunnel_send_multicast (t, &msg.header); | 3463 | |
3677 | } | ||
3678 | if (0 == parent) | 3464 | if (0 == parent) |
3679 | parent = tree_get_predecessor (t->tree); | 3465 | parent = tree_get_predecessor (t->tree); |
3680 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " parent: %u\n", parent); | 3466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " parent: %u\n", parent); |
@@ -3803,13 +3589,6 @@ tunnel_destroy (struct MeshTunnel *t) | |||
3803 | GNUNET_free_non_null (t->ignore); | 3589 | GNUNET_free_non_null (t->ignore); |
3804 | GNUNET_free_non_null (t->clients_fc); | 3590 | GNUNET_free_non_null (t->clients_fc); |
3805 | 3591 | ||
3806 | if (NULL != t->peers) | ||
3807 | { | ||
3808 | GNUNET_CONTAINER_multihashmap_iterate (t->peers, &peer_info_delete_tunnel, | ||
3809 | t); | ||
3810 | GNUNET_CONTAINER_multihashmap_destroy (t->peers); | ||
3811 | } | ||
3812 | |||
3813 | GNUNET_CONTAINER_multihashmap_iterate (t->children_fc, | 3592 | GNUNET_CONTAINER_multihashmap_iterate (t->children_fc, |
3814 | &tunnel_destroy_child, | 3593 | &tunnel_destroy_child, |
3815 | t); | 3594 | t); |
@@ -3819,10 +3598,6 @@ tunnel_destroy (struct MeshTunnel *t) | |||
3819 | tree_iterate_children (t->tree, &tunnel_cancel_queues, t); | 3598 | tree_iterate_children (t->tree, &tunnel_cancel_queues, t); |
3820 | tree_destroy (t->tree); | 3599 | tree_destroy (t->tree); |
3821 | 3600 | ||
3822 | if (NULL != t->regex_search) | ||
3823 | GNUNET_REGEX_search_cancel (t->regex_search->search_handle); | ||
3824 | if (NULL != t->dht_get_type) | ||
3825 | GNUNET_DHT_get_stop (t->dht_get_type); | ||
3826 | if (GNUNET_SCHEDULER_NO_TASK != t->timeout_task) | 3601 | if (GNUNET_SCHEDULER_NO_TASK != t->timeout_task) |
3827 | GNUNET_SCHEDULER_cancel (t->timeout_task); | 3602 | GNUNET_SCHEDULER_cancel (t->timeout_task); |
3828 | if (GNUNET_SCHEDULER_NO_TASK != t->path_refresh_task) | 3603 | if (GNUNET_SCHEDULER_NO_TASK != t->path_refresh_task) |
@@ -4136,8 +3911,6 @@ send_core_path_create (void *cls, size_t size, void *buf) | |||
4136 | msg->tid = ntohl (t->id.tid); | 3911 | msg->tid = ntohl (t->id.tid); |
4137 | 3912 | ||
4138 | opt = 0; | 3913 | opt = 0; |
4139 | if (GNUNET_YES == t->speed_min) | ||
4140 | opt |= MESH_TUNNEL_OPT_SPEED_MIN; | ||
4141 | if (GNUNET_YES == t->nobuffer) | 3914 | if (GNUNET_YES == t->nobuffer) |
4142 | opt |= MESH_TUNNEL_OPT_NOBUFFER; | 3915 | opt |= MESH_TUNNEL_OPT_NOBUFFER; |
4143 | msg->opt = htonl(opt); | 3916 | msg->opt = htonl(opt); |
@@ -4188,25 +3961,11 @@ send_core_data_multicast (void *cls, size_t size, void *buf) | |||
4188 | memcpy (buf, info->mesh_data->data, total_size); | 3961 | memcpy (buf, info->mesh_data->data, total_size); |
4189 | #if MESH_DEBUG | 3962 | #if MESH_DEBUG |
4190 | { | 3963 | { |
4191 | struct GNUNET_MESH_Multicast *mc; | ||
4192 | struct GNUNET_MessageHeader *mh; | 3964 | struct GNUNET_MessageHeader *mh; |
4193 | 3965 | ||
4194 | mh = buf; | 3966 | mh = buf; |
4195 | if (ntohs (mh->type) == GNUNET_MESSAGE_TYPE_MESH_MULTICAST) | 3967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " type %s\n", |
4196 | { | 3968 | GNUNET_MESH_DEBUG_M2S (ntohs (mh->type))); |
4197 | mc = (struct GNUNET_MESH_Multicast *) mh; | ||
4198 | mh = (struct GNUNET_MessageHeader *) &mc[1]; | ||
4199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4200 | " multicast, payload type %s\n", | ||
4201 | GNUNET_MESH_DEBUG_M2S (ntohs (mh->type))); | ||
4202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4203 | " multicast, payload size %u\n", ntohs (mh->size)); | ||
4204 | } | ||
4205 | else | ||
4206 | { | ||
4207 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " type %s\n", | ||
4208 | GNUNET_MESH_DEBUG_M2S (ntohs (mh->type))); | ||
4209 | } | ||
4210 | } | 3969 | } |
4211 | #endif | 3970 | #endif |
4212 | data_descriptor_decrement_rc (info->mesh_data); | 3971 | data_descriptor_decrement_rc (info->mesh_data); |
@@ -4516,31 +4275,6 @@ queue_send (void *cls, size_t size, void *buf) | |||
4516 | break; | 4275 | break; |
4517 | } | 4276 | } |
4518 | break; | 4277 | break; |
4519 | case GNUNET_MESSAGE_TYPE_MESH_MULTICAST: | ||
4520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* multicast\n"); | ||
4521 | { | ||
4522 | struct MeshTransmissionDescriptor *info = queue->cls; | ||
4523 | |||
4524 | if ((1 == info->mesh_data->reference_counter | ||
4525 | && GNUNET_YES == t->speed_min) | ||
4526 | || | ||
4527 | (info->mesh_data->total_out == info->mesh_data->reference_counter | ||
4528 | && GNUNET_NO == t->speed_min)) | ||
4529 | { | ||
4530 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4531 | "********* considered sent\n"); | ||
4532 | t->fwd_queue_n--; | ||
4533 | } | ||
4534 | else | ||
4535 | { | ||
4536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4537 | "********* NOT considered sent yet\n"); | ||
4538 | t->pending_messages++; | ||
4539 | } | ||
4540 | } | ||
4541 | data_size = send_core_data_multicast(queue->cls, size, buf); | ||
4542 | tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_MULTICAST); | ||
4543 | break; | ||
4544 | case GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE: | 4278 | case GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE: |
4545 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path create\n"); | 4279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path create\n"); |
4546 | data_size = send_core_path_create (queue->cls, size, buf); | 4280 | data_size = send_core_path_create (queue->cls, size, buf); |
@@ -4812,16 +4546,12 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4812 | return GNUNET_OK; | 4546 | return GNUNET_OK; |
4813 | } | 4547 | } |
4814 | opt = ntohl (msg->opt); | 4548 | opt = ntohl (msg->opt); |
4815 | t->speed_min = (0 != (opt & MESH_TUNNEL_OPT_SPEED_MIN)) ? | ||
4816 | GNUNET_YES : GNUNET_NO; | ||
4817 | if (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER)) | 4549 | if (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER)) |
4818 | { | 4550 | { |
4819 | t->nobuffer = GNUNET_YES; | 4551 | t->nobuffer = GNUNET_YES; |
4820 | t->last_fwd_ack = t->fwd_pid + 1; | 4552 | t->last_fwd_ack = t->fwd_pid + 1; |
4821 | } | 4553 | } |
4822 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4554 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " nobuffer:%d\n", t->nobuffer); |
4823 | " speed_min: %d, nobuffer:%d\n", | ||
4824 | t->speed_min, t->nobuffer); | ||
4825 | 4555 | ||
4826 | if (GNUNET_YES == t->nobuffer) | 4556 | if (GNUNET_YES == t->nobuffer) |
4827 | { | 4557 | { |
@@ -4897,12 +4627,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4897 | /* It is for us! Send ack. */ | 4627 | /* It is for us! Send ack. */ |
4898 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); | 4628 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); |
4899 | peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); | 4629 | peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); |
4900 | GNUNET_break (GNUNET_SYSERR != | 4630 | t->peer = myid; |
4901 | GNUNET_CONTAINER_multihashmap_put (t->peers, | ||
4902 | &my_full_id.hashPubKey, | ||
4903 | peer_info_get | ||
4904 | (&my_full_id), | ||
4905 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)); | ||
4906 | send_path_ack (t); | 4631 | send_path_ack (t); |
4907 | } | 4632 | } |
4908 | else | 4633 | else |
@@ -5582,7 +5307,7 @@ handle_mesh_keepalive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5582 | tunnel_reset_timeout (t); | 5307 | tunnel_reset_timeout (t); |
5583 | 5308 | ||
5584 | GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO); | 5309 | GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO); |
5585 | tunnel_send_multicast (t, message); | 5310 | /* FIXME tunnel_send_multicast (t, message); */ |
5586 | return GNUNET_OK; | 5311 | return GNUNET_OK; |
5587 | } | 5312 | } |
5588 | 5313 | ||
@@ -5686,7 +5411,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5686 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE); | 5411 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE); |
5687 | msg->oid = my_full_id; | 5412 | msg->oid = my_full_id; |
5688 | msg->tid = htonl (t->id.tid); | 5413 | msg->tid = htonl (t->id.tid); |
5689 | tunnel_send_multicast (t, &msg->header); | 5414 | /* FIXME tunnel_send_multicast (t, &msg->header); */ |
5690 | 5415 | ||
5691 | t->path_refresh_task = | 5416 | t->path_refresh_task = |
5692 | GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t); | 5417 | GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t); |
diff --git a/src/mesh/mesh2_protocol.h b/src/mesh/mesh2_protocol.h index 9de407625..0ccbecc43 100644 --- a/src/mesh/mesh2_protocol.h +++ b/src/mesh/mesh2_protocol.h | |||
@@ -35,7 +35,6 @@ extern "C" | |||
35 | #endif | 35 | #endif |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #define MESH_TUNNEL_OPT_SPEED_MIN 0x1 | ||
39 | #define MESH_TUNNEL_OPT_NOBUFFER 0x2 | 38 | #define MESH_TUNNEL_OPT_NOBUFFER 0x2 |
40 | 39 | ||
41 | 40 | ||