gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35576 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r35576 - gnunet/src/cadet
Date: Mon, 27 Apr 2015 21:14:10 +0200

Author: bartpolot
Date: 2015-04-27 21:14:10 +0200 (Mon, 27 Apr 2015)
New Revision: 35576

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
- if C is NULL, can't use it for getting the ID

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-04-27 19:14:09 UTC 
(rev 35575)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-04-27 19:14:10 UTC 
(rev 35576)
@@ -2111,12 +2111,14 @@
  *
  * @param message Message to check. It must belong to an existing connection.
  * @param minimum_size The message cannot be smaller than this value.
+ * @param cid Connection ID (even if @a c is NULL, the ID is still needed).
  * @param c Connection this message should belong. If NULL, check fails.
  * @param neighbor Neighbor that sent the message.
  */
 static int
 check_message (const struct GNUNET_MessageHeader *message,
                size_t minimum_size,
+               struct GNUNET_CADET_Hash* cid,
                struct CadetConnection *c,
                const struct GNUNET_PeerIdentity *neighbor,
                uint32_t pid)
@@ -2137,9 +2139,9 @@
   if (NULL == c)
   {
     GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "enc_ax on unknown connection %s\n",
-         GNUNET_h2s (GC_h2hc (&c->id)));
-    send_broken_unknown (&c->id, &my_full_id, NULL, neighbor);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "%s on unknown connection %s\n",
+         GC_m2s (ntohs (message->type)), GNUNET_h2s (GC_h2hc (cid)));
+    send_broken_unknown (cid, &my_full_id, NULL, neighbor);
     return GNUNET_SYSERR;
   }
 
@@ -2228,6 +2230,7 @@
                         const struct GNUNET_MessageHeader *message)
 {
   const struct GNUNET_CADET_Encrypted *msg;
+  struct GNUNET_CADET_Hash* cid;
   struct CadetConnection *c;
   size_t expected_size;
   uint32_t pid;
@@ -2235,13 +2238,14 @@
   int fwd;
 
   msg = (struct GNUNET_CADET_Encrypted *) message;
-  log_message (message, peer, &msg->cid);
+  cid = &msg->cid;
+  log_message (message, peer, cid);
 
   expected_size = sizeof (struct GNUNET_CADET_Encrypted)
                   + sizeof (struct GNUNET_MessageHeader);
-  c = connection_get (&msg->cid);
+  c = connection_get (cid);
   pid = ntohl (msg->pid);
-  fwd = check_message (message, expected_size, c, peer, pid);
+  fwd = check_message (message, expected_size, cid, c, peer, pid);
 
   /* If something went wrong, discard message. */
   if (GNUNET_SYSERR == fwd)
@@ -2396,8 +2400,7 @@
 GCC_handle_kx (void *cls, const struct GNUNET_PeerIdentity *peer,
                const struct GNUNET_MessageHeader *message)
 {
-  return handle_cadet_kx (peer,
-                          (struct GNUNET_CADET_KX *) message);
+  return handle_cadet_kx (peer, (struct GNUNET_CADET_KX *) message);
 }
 
 




reply via email to

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