aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh_tunnel.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-12-17 05:18:16 +0000
committerBart Polot <bart@net.in.tum.de>2013-12-17 05:18:16 +0000
commitb43441b72fd4d9181edfc1e57a8bd9dfeef51a1f (patch)
treef2131c729f2fdb0868d96c507f58783aebd930ed /src/mesh/gnunet-service-mesh_tunnel.c
parent89a7774af91682ffb47274744a3f6bc2a905e51f (diff)
downloadgnunet-b43441b72fd4d9181edfc1e57a8bd9dfeef51a1f.tar.gz
gnunet-b43441b72fd4d9181edfc1e57a8bd9dfeef51a1f.zip
- respond to data on unknown channels with destroy (avoids retransmissions)
Diffstat (limited to 'src/mesh/gnunet-service-mesh_tunnel.c')
-rw-r--r--src/mesh/gnunet-service-mesh_tunnel.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c
index a65d85f66..b6ff4f2d4 100644
--- a/src/mesh/gnunet-service-mesh_tunnel.c
+++ b/src/mesh/gnunet-service-mesh_tunnel.c
@@ -541,6 +541,7 @@ t_decrypt (struct MeshTunnel3 *t,
541 LOG (GNUNET_ERROR_TYPE_DEBUG, 541 LOG (GNUNET_ERROR_TYPE_DEBUG,
542 "WARNING got data on %s without a valid key\n", 542 "WARNING got data on %s without a valid key\n",
543 GMT_2s (t)); 543 GMT_2s (t));
544 GMT_debug (t);
544 return 0; 545 return 0;
545 } 546 }
546 547
@@ -1133,6 +1134,29 @@ destroy_iterator (void *cls,
1133 1134
1134 1135
1135/** 1136/**
1137 * Notify remote peer that we don't know a channel he is talking about,
1138 * probably CHANNEL_DESTROY was missed.
1139 *
1140 * @param t Tunnel on which to notify.
1141 * @param gid ID of the channel.
1142 */
1143static void
1144send_channel_destroy (struct MeshTunnel3 *t, unsigned int gid)
1145{
1146 struct GNUNET_MESH_ChannelManage msg;
1147
1148 msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY);
1149 msg.header.size = htons (sizeof (msg));
1150 msg.chid = htonl (gid);
1151
1152 LOG (GNUNET_ERROR_TYPE_DEBUG,
1153 "WARNING destroying unknown channel %u on tunnel %s\n",
1154 gid, GMT_2s (t));
1155 send_prebuilt_message (&msg.header, t, GNUNET_YES, NULL, NULL, NULL);
1156}
1157
1158
1159/**
1136 * Demultiplex data per channel and call appropriate channel handler. 1160 * Demultiplex data per channel and call appropriate channel handler.
1137 * 1161 *
1138 * @param t Tunnel on which the data came. 1162 * @param t Tunnel on which the data came.
@@ -1170,6 +1194,7 @@ handle_data (struct MeshTunnel3 *t,
1170 1, GNUNET_NO); 1194 1, GNUNET_NO);
1171 LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel 0x%X unknown\n", 1195 LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING channel 0x%X unknown\n",
1172 ntohl (msg->chid)); 1196 ntohl (msg->chid));
1197 send_channel_destroy (t, ntohl (msg->chid));
1173 return; 1198 return;
1174 } 1199 }
1175 1200