- dont send duplicate acks, allow null client
authorBart Polot <bart@net.in.tum.de>
Fri, 27 Jul 2012 13:07:19 +0000 (13:07 +0000)
committerBart Polot <bart@net.in.tum.de>
Fri, 27 Jul 2012 13:07:19 +0000 (13:07 +0000)
src/mesh/gnunet-service-mesh.c

index 114dc8d6a084694f02599c93d9cd62ae944a4ba5..858b87bbd160f64bab51d7c653876ea3381387d7 100644 (file)
@@ -1943,12 +1943,19 @@ send_client_tunnel_ack (struct MeshClient *c, struct MeshTunnel *t)
   struct GNUNET_MESH_LocalAck msg;
   uint32_t ack;
 
+  if (NULL == c)
+    return;
+
   ack = tunnel_get_ack (t);
 
+  if (t->last_ack == ack)
+    return;
+
+  t->last_ack = ack;
   msg.header.size = htons (sizeof (msg));
   msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
   msg.tunnel_id = htonl (t->local_tid);
-  msg.max_pid = ack;
+  msg.max_pid = htonl (ack);
 
   GNUNET_SERVER_notification_context_unicast (nc, c->handle,
                                               &msg.header, GNUNET_NO);