diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-10-18 11:13:33 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-10-18 11:13:33 +0000 |
commit | a3122bfda5ad59fff1d790b3e5daa3044e62bb57 (patch) | |
tree | b287b07ad6698cfd04c85b96a503f39b646059e1 /src | |
parent | faf5aea8c8ce918703923af2fac0ad9105ee6764 (diff) | |
download | gnunet-a3122bfda5ad59fff1d790b3e5daa3044e62bb57.tar.gz gnunet-a3122bfda5ad59fff1d790b3e5daa3044e62bb57.zip |
- fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 16 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 5 | ||||
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 10 |
3 files changed, 23 insertions, 8 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index bee65c65c..0a74115e3 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -1086,18 +1086,32 @@ GMCH_send_create (struct MeshChannel *ch) | |||
1086 | 1086 | ||
1087 | /** | 1087 | /** |
1088 | * Notify a client that the channel is no longer valid. | 1088 | * Notify a client that the channel is no longer valid. |
1089 | * FIXME send on tunnel if some client == NULL? | ||
1090 | * | 1089 | * |
1091 | * @param ch Channel that is destroyed. | 1090 | * @param ch Channel that is destroyed. |
1092 | */ | 1091 | */ |
1093 | void | 1092 | void |
1094 | GMCH_send_destroy (struct MeshChannel *ch) | 1093 | GMCH_send_destroy (struct MeshChannel *ch) |
1095 | { | 1094 | { |
1095 | struct GNUNET_MESH_ChannelManage msg; | ||
1096 | |||
1097 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); | ||
1098 | msg.header.size = htons (sizeof (msg)); | ||
1099 | msg.chid = htonl (ch->gid); | ||
1100 | |||
1101 | /* If root is not NULL, notify. | ||
1102 | * If it's NULL, check lid_root. When a local destroy comes in, root | ||
1103 | * is set to NULL but lid_root is left untouched. In this case, do nothing, | ||
1104 | * the client is the one who reuqested the channel to be destroyed. | ||
1105 | */ | ||
1096 | if (NULL != ch->root) | 1106 | if (NULL != ch->root) |
1097 | GML_send_channel_destroy (ch->root, ch->lid_root); | 1107 | GML_send_channel_destroy (ch->root, ch->lid_root); |
1108 | else if (0 == ch->lid_root) | ||
1109 | GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO); | ||
1098 | 1110 | ||
1099 | if (NULL != ch->dest) | 1111 | if (NULL != ch->dest) |
1100 | GML_send_channel_destroy (ch->dest, ch->lid_dest); | 1112 | GML_send_channel_destroy (ch->dest, ch->lid_dest); |
1113 | else if (0 == ch->lid_dest) | ||
1114 | GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_YES); | ||
1101 | } | 1115 | } |
1102 | 1116 | ||
1103 | 1117 | ||
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index 99b156595..afdb801c9 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -1405,13 +1405,14 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1405 | } | 1405 | } |
1406 | else | 1406 | else |
1407 | { | 1407 | { |
1408 | /* Unexpected peer sending traffic on a connection. */ | ||
1408 | GNUNET_break_op (0); | 1409 | GNUNET_break_op (0); |
1409 | return GNUNET_OK; | 1410 | return GNUNET_OK; |
1410 | } | 1411 | } |
1411 | } | 1412 | } |
1412 | fc = fwd ? &c->bck_fc : &c->fwd_fc; | ||
1413 | 1413 | ||
1414 | /* Check PID */ | 1414 | /* Check PID */ |
1415 | fc = fwd ? &c->bck_fc : &c->fwd_fc; | ||
1415 | pid = ntohl (msg->pid); | 1416 | pid = ntohl (msg->pid); |
1416 | if (GMC_is_pid_bigger (pid, fc->last_ack_sent)) | 1417 | if (GMC_is_pid_bigger (pid, fc->last_ack_sent)) |
1417 | { | 1418 | { |
@@ -1429,7 +1430,7 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1429 | pid, fc->last_pid_recv + 1); | 1430 | pid, fc->last_pid_recv + 1); |
1430 | return GNUNET_OK; | 1431 | return GNUNET_OK; |
1431 | } | 1432 | } |
1432 | if (MESH_CONNECTION_SENT == c->state) | 1433 | if (MESH_CONNECTION_SENT == c->state || MESH_CONNECTION_ACK == c->state) |
1433 | connection_change_state (c, MESH_CONNECTION_READY); | 1434 | connection_change_state (c, MESH_CONNECTION_READY); |
1434 | connection_reset_timeout (c, fwd); | 1435 | connection_reset_timeout (c, fwd); |
1435 | fc->last_pid_recv = pid; | 1436 | fc->last_pid_recv = pid; |
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 11c7019c3..d6922f76a 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -474,7 +474,7 @@ handle_ch_destroy (struct MeshTunnel3 *t, | |||
474 | * @param fwd Is this message fwd? | 474 | * @param fwd Is this message fwd? |
475 | */ | 475 | */ |
476 | static void | 476 | static void |
477 | handle_GMT_decrypted (struct MeshTunnel3 *t, | 477 | handle_decrypted (struct MeshTunnel3 *t, |
478 | const struct GNUNET_MessageHeader *msgh, | 478 | const struct GNUNET_MessageHeader *msgh, |
479 | int fwd) | 479 | int fwd) |
480 | { | 480 | { |
@@ -551,7 +551,7 @@ GMT_handle_encrypted (struct MeshTunnel3 *t, | |||
551 | while (off < payload_size) | 551 | while (off < payload_size) |
552 | { | 552 | { |
553 | msgh = (struct GNUNET_MessageHeader *) &cbuf[off]; | 553 | msgh = (struct GNUNET_MessageHeader *) &cbuf[off]; |
554 | handle_GMT_decrypted (t, msgh, fwd); | 554 | handle_decrypted (t, msgh, fwd); |
555 | off += ntohs (msgh->size); | 555 | off += ntohs (msgh->size); |
556 | } | 556 | } |
557 | } | 557 | } |
@@ -1172,9 +1172,9 @@ GMT_send_acks (struct MeshTunnel3 *t, int fwd) | |||
1172 | unsigned int cs; | 1172 | unsigned int cs; |
1173 | unsigned int buffer; | 1173 | unsigned int buffer; |
1174 | 1174 | ||
1175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1175 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1176 | "Tunnel send %s ACKs on %s\n", | 1176 | "Tunnel send %s ACKs on %s\n", |
1177 | fwd ? "FWD" : "BCK", GMT_2s (t)); | 1177 | fwd ? "FWD" : "BCK", GMT_2s (t)); |
1178 | 1178 | ||
1179 | if (NULL == t) | 1179 | if (NULL == t) |
1180 | { | 1180 | { |