gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r27471 - in gnunet/src: include mesh


From: gnunet
Subject: [GNUnet-SVN] r27471 - in gnunet/src: include mesh
Date: Wed, 19 Jun 2013 02:11:19 +0200

Author: bartpolot
Date: 2013-06-19 02:11:19 +0200 (Wed, 19 Jun 2013)
New Revision: 27471

Modified:
   gnunet/src/include/gnunet_mesh2_service.h
   gnunet/src/mesh/mesh2_api.c
Log:
- fix 2897: data handler SYSERR closes tunnel, not whole handler

Modified: gnunet/src/include/gnunet_mesh2_service.h
===================================================================
--- gnunet/src/include/gnunet_mesh2_service.h   2013-06-18 23:46:15 UTC (rev 
27470)
+++ gnunet/src/include/gnunet_mesh2_service.h   2013-06-19 00:11:19 UTC (rev 
27471)
@@ -73,7 +73,7 @@
  * @param sender Peer who sent the message.
  * @param message The actual message.
  * 
- * @return GNUNET_OK to keep the connection open,
+ * @return GNUNET_OK to keep the tunnel open,
  *         GNUNET_SYSERR to close it (signal serious error).
  */
 typedef int (*GNUNET_MESH_MessageCallback) (void *cls,

Modified: gnunet/src/mesh/mesh2_api.c
===================================================================
--- gnunet/src/mesh/mesh2_api.c 2013-06-18 23:46:15 UTC (rev 27470)
+++ gnunet/src/mesh/mesh2_api.c 2013-06-19 00:11:19 UTC (rev 27471)
@@ -864,11 +864,8 @@
  *
  * @param h         The mesh handle
  * @param message   A message encapsulating the data
- * 
- * @return GNUNET_YES if everything went fine
- *         GNUNET_NO if client closed connection (h no longer valid)
  */
-static int
+static void
 process_incoming_data (struct GNUNET_MESH_Handle *h,
                        const struct GNUNET_MessageHeader *message)
 {
@@ -909,14 +906,14 @@
     break;
   default:
     GNUNET_break (0);
-    return GNUNET_YES;
+    return;
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  pid %u\n", pid);
   if (NULL == t)
   {
     /* Tunnel was ignored/destroyed, probably service didn't get it yet */
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  ignored!\n");
-    return GNUNET_YES;
+    return;
   }
   if (GNUNET_YES ==
       GMC_is_pid_bigger(pid, t->last_ack_sent))
@@ -926,7 +923,7 @@
          "  unauthorized message! (%u, ACK %u)\n",
          pid, t->last_ack_sent);
     // FIXME fc what now? accept? reject?
-    return GNUNET_YES;
+    return;
   }
   t->last_pid_recv = pid;
   type = ntohs (payload->type);
@@ -939,8 +936,8 @@
           handler->callback (h->cls, t, &t->ctx, peer, payload))
       {
         LOG (GNUNET_ERROR_TYPE_DEBUG, "callback caused disconnection\n");
-        GNUNET_MESH_disconnect (h);
-        return GNUNET_NO;
+        GNUNET_MESH_tunnel_destroy (t);
+        return;
       }
       else
       {
@@ -949,7 +946,6 @@
       }
     }
   }
-  return GNUNET_YES;
 }
 
 
@@ -1119,8 +1115,7 @@
   case GNUNET_MESSAGE_TYPE_MESH_UNICAST:
   case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
   case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
-    if (GNUNET_NO == process_incoming_data (h, msg))
-      return;
+    process_incoming_data (h, msg);
     break;
   case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK:
     process_ack (h, msg);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]