fix crash on unexpected client disconnect on incoming message, remove bogus assertion
authorChristian Grothoff <christian@grothoff.org>
Mon, 21 May 2018 16:10:38 +0000 (18:10 +0200)
committerChristian Grothoff <christian@grothoff.org>
Mon, 21 May 2018 16:10:38 +0000 (18:10 +0200)
src/cadet/cadet_api.c
src/cadet/gnunet-service-cadet_channel.c
src/dht/plugin_block_dht.c
src/rps/test_rps.c
src/rps/test_rps.conf

index 3c142a95c69f2f5a2e79e5c282aca6b52ce584c9..59f0bfe85d756a8700e4f108c7f0b9106431df1b 100644 (file)
@@ -464,6 +464,10 @@ cadet_mq_send_now (void *cls)
   }
   ch->allow_send--;
   ch->pending_env = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending message on channel %s to CADET, new window size is %u\n",
+              GNUNET_i2s (&ch->peer),
+              ch->allow_send);
   GNUNET_MQ_send (ch->cadet->mq,
                   env);
   GNUNET_MQ_impl_send_continue (ch->mq);
@@ -781,6 +785,11 @@ handle_local_ack (void *cls,
     return;
   }
   ch->allow_send++;
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Got an ACK on mq channel %X (peer %s); new window size is %u!\n",
+       ntohl (ch->ccn.channel_of_client),
+       GNUNET_i2s (&ch->peer),
+       ch->allow_send);
   if (NULL == ch->pending_env)
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -792,9 +801,6 @@ handle_local_ack (void *cls,
   }
   if (NULL != ch->mq_cont)
     return; /* already working on it! */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Got an ACK on mq channel %X, sending pending message!\n",
-       ntohl (ch->ccn.channel_of_client));
   ch->mq_cont
     = GNUNET_SCHEDULER_add_now (&cadet_mq_send_now,
                                 ch);
@@ -992,6 +998,7 @@ check_get_tunnels (void *cls,
 {
   size_t esize;
 
+  (void) cls;
   esize = ntohs (message->size);
   if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) == esize)
     return GNUNET_OK;
@@ -1051,6 +1058,7 @@ check_get_tunnel (void *cls,
   size_t esize;
   size_t msize;
 
+  (void) cls;
   /* Verify message sanity */
   msize = ntohs (msg->header.size);
   esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
@@ -1096,7 +1104,6 @@ handle_get_tunnel (void *cls,
 
   if (NULL == h->info_cb.tunnel_cb)
     return;
-
   ch_n = ntohl (msg->channels);
   c_n = ntohl (msg->connections);
 
@@ -1191,13 +1198,8 @@ destroy_channel_cb (void *cls,
   /* struct GNUNET_CADET_Handle *handle = cls; */
   struct GNUNET_CADET_Channel *ch = value;
 
-  if (ntohl (ch->ccn.channel_of_client) >= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI)
-  {
-    GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "channel %X not destroyed\n",
-         ntohl (ch->ccn.channel_of_client));
-  }
+  (void) cls;
+  (void) cid;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
              "Destroying channel due to GNUNET_CADET_disconnect()\n");
   destroy_channel (ch);
@@ -1222,6 +1224,7 @@ destroy_port_cb (void *cls,
   /* struct GNUNET_CADET_Handle *handle = cls; */
   struct GNUNET_CADET_Port *port = value;
 
+  (void) cls;
   /* This is a warning, the app should have cleanly closed all open ports */
   GNUNET_break (0);
   GNUNET_CADET_close_port (port);
index 7a7942dea875071548424a932989067d62f4f952..2d8d36c6c8d33b0d7c19c6d087588c3700bbbd09 100644 (file)
@@ -1279,8 +1279,7 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch,
   uint32_t delta;
 
   GNUNET_assert (GNUNET_NO == ch->is_loopback);
-  if ( (GNUNET_YES == ch->destroy) &&
-       (NULL == ch->owner) &&
+  if ( (NULL == ch->owner) &&
        (NULL == ch->dest) )
   {
     /* This client is gone, but we still have messages to send to
@@ -1290,8 +1289,9 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch,
          "Dropping incoming payload on %s as this end is already closed\n",
          GCCH_2s (ch));
     /* send back DESTROY notification to stop further retransmissions! */
-    GCT_send_channel_destroy (ch->t,
-                              ch->ctn);
+    if (GNUNET_YES == ch->destroy)
+      GCT_send_channel_destroy (ch->t,
+                                ch->ctn);
     return;
   }
   payload_size = ntohs (msg->header.size) - sizeof (*msg);
index 24f8b21b253937ef8a3c0b4486a0e121e71b82a2..9f2861b50c12d5302b80336cba9d77731cb3d19c 100644 (file)
@@ -66,7 +66,8 @@ block_plugin_dht_create_group (void *cls,
   guard = va_arg (va, const char *);
   if (0 == strcmp (guard,
                    "seen-set-size"))
-    bf_size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size (va_arg (va, unsigned int),
+    bf_size = GNUNET_BLOCK_GROUP_compute_bloomfilter_size (va_arg (va,
+                                                                   unsigned int),
                                                            BLOOMFILTER_K);
   else if (0 == strcmp (guard,
                         "filter-size"))
@@ -183,14 +184,17 @@ block_plugin_dht_get_key (void *cls,
     return GNUNET_SYSERR;
   if (block_size < sizeof (struct GNUNET_MessageHeader))
   {
-    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "block-dht",
-                     _("Block not of type %u\n"), GNUNET_BLOCK_TYPE_DHT_HELLO);
+    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                     "block-dht",
+                     _("Block not of type %u\n"),
+                     GNUNET_BLOCK_TYPE_DHT_HELLO);
     return GNUNET_NO;
   }
   msg = block;
   if (block_size != ntohs (msg->size))
   {
-    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "block-dht",
+    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                     "block-dht",
                      _("Size mismatch for block\n"),
                      GNUNET_BLOCK_TYPE_DHT_HELLO);
     return GNUNET_NO;
@@ -200,7 +204,8 @@ block_plugin_dht_get_key (void *cls,
   pid = (struct GNUNET_PeerIdentity *) key;
   if (GNUNET_OK != GNUNET_HELLO_get_id (hello, pid))
   {
-    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "block-dht",
+    GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                     "block-dht",
                      _("Block of type %u is malformed\n"),
                      GNUNET_BLOCK_TYPE_DHT_HELLO);
     return GNUNET_NO;
index bae28428f6a0e5f8c788b41c7cf1e2acf05851cd..542919425da19ca90984fe8603233794f3157e12 100644 (file)
@@ -2782,7 +2782,7 @@ main (int argc, char *argv[])
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n");
     cur_test_run.name = "test-rps-profiler";
-    num_peers = 100;
+    num_peers = 10;
     mal_type = 3;
     cur_test_run.init_peer = profiler_init_peer;
     //cur_test_run.pre_test = mal_pre;
index f171335d6d6ff1857a4bb1ecbfcf1ee970995527..cf6b3150c1cbad631208fa0d5f505545f33e572b 100644 (file)
@@ -29,7 +29,7 @@ HOSTNAME = localhost
 # MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 100
 OVERLAY_TOPOLOGY = CLIQUE
 #OVERLAY_TOPOLOGY = SMALL_WORLD
-#SCALE_FREE_TOPOLOGY_CAP = 
+#SCALE_FREE_TOPOLOGY_CAP =
 
 # OVERLAY_RANDOM_LINKS = 25
 
@@ -74,6 +74,7 @@ DISABLE_TRY_CONNECT = YES
 [cadet]
 DISABLE_TRY_CONNECT = YES
 #OPTIONS=-l /tmp/rps_profiler_logs/cadet-[]-%Y-%m-%d.log
+#PREFIX = valgrind
 
 #[arm]
 #GLOBAL_POSTFIX=-l /tmp/rps_profiler_logs/other-[]-%Y-%m-%d.log
@@ -120,4 +121,3 @@ AUTOSTART = NO
 [fs]
 FORCESTART = NO
 AUTOSTART = NO
-