From: Bart Polot Date: Thu, 11 Oct 2012 16:19:02 +0000 (+0000) Subject: - check for to_origin duplicates X-Git-Tag: initial-import-from-subversion-38251~11441 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1d116671d2464dcf0bdbab9671be02bde339068a;p=oweals%2Fgnunet.git - check for to_origin duplicates --- diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 1792faee8..006cc3b38 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -5742,7 +5742,6 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " of type %s\n", GNUNET_MESH_DEBUG_M2S (ntohs (msg[1].header.type))); t = tunnel_get (&msg->oid, ntohl (msg->tid)); - pid = ntohl (msg->pid); if (NULL == t) { @@ -5755,6 +5754,22 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer, return GNUNET_OK; } + pid = ntohl (msg->pid); + if (t->bck_pid == pid) + { + /* already seen this packet, drop */ + GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, GNUNET_NO); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + " Already seen pid %u, DROPPING!\n", pid); + tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); + return GNUNET_OK; + } + else + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + " pid %u not seen yet, forwarding\n", pid); + } + if (NULL != t->owner) { char cbuf[size];