gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37892 - gnunet/src/rps


From: gnunet
Subject: [GNUnet-SVN] r37892 - gnunet/src/rps
Date: Tue, 6 Sep 2016 13:42:36 +0200

Author: ch3
Date: 2016-09-06 13:42:35 +0200 (Tue, 06 Sep 2016)
New Revision: 37892

Modified:
   gnunet/src/rps/gnunet-service-rps.c
Log:
-rps service: improved handling of errors

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2016-09-06 11:11:11 UTC (rev 37891)
+++ gnunet/src/rps/gnunet-service-rps.c 2016-09-06 11:42:35 UTC (rev 37892)
@@ -1143,9 +1143,10 @@
 
   if (sizeof (struct GNUNET_RPS_CS_SeedMessage) > ntohs (message->size))
   {
-    GNUNET_break_op (0);
     GNUNET_SERVER_receive_done (client,
                                 GNUNET_SYSERR);
+    GNUNET_break_op (0);
+    return;
   }
 
   in_msg = (struct GNUNET_RPS_CS_SeedMessage *) message;
@@ -1254,6 +1255,7 @@
                                    tmp_att_peer);
       add_peer_array_to_set (peer, 1, att_peer_set);
     }
+    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
 
@@ -1260,6 +1262,7 @@
 
   else if (2 == mal_type)
   { /* We attack one single well-known peer - simply ignore */
+    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
   else
@@ -1308,6 +1311,7 @@
       || 3 == mal_type)
   { /* Try to maximise representation */
     send_pull_reply (peer, mal_peers, num_mal_peers);
+    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
 
@@ -1317,6 +1321,7 @@
     {
       send_pull_reply (peer, mal_peers, num_mal_peers);
     }
+    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
   #endif /* ENABLE_MALICIOUS */
@@ -1388,8 +1393,8 @@
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
         "Received a pull reply from a peer we didn't request one from!\n");
+    GNUNET_CADET_receive_done (channel);
     GNUNET_break_op (0);
-    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
   }
 
@@ -1397,7 +1402,10 @@
   #ifdef ENABLE_MALICIOUS
   // We shouldn't even receive pull replies as we're not sending
   if (2 == mal_type)
+  {
+    GNUNET_CADET_receive_done (channel);
     return GNUNET_OK;
+  }
   #endif /* ENABLE_MALICIOUS */
 
   /* Do actual logic */
@@ -1579,6 +1587,7 @@
   /* Check for protocol violation */
   if (sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage) > ntohs (msg->size))
   {
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     GNUNET_break_op (0);
   }
 
@@ -1591,6 +1600,7 @@
         ntohl (in_msg->num_peers),
         (ntohs (msg->size) - sizeof (struct 
GNUNET_RPS_CS_ActMaliciousMessage)) /
             sizeof (struct GNUNET_PeerIdentity));
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
     GNUNET_break_op (0);
   }
 
@@ -1681,9 +1691,9 @@
   else
   {
     GNUNET_break (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_OK);
   }
-  GNUNET_SERVER_receive_done (client,
-                             GNUNET_OK);
+  GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
 




reply via email to

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