RPS profiler: Try to avoid assertion on request_cancel
authorJulius Bünger <buenger@mytum.de>
Wed, 31 Oct 2018 10:59:51 +0000 (11:59 +0100)
committerJulius Bünger <buenger@mytum.de>
Wed, 31 Oct 2018 11:04:02 +0000 (12:04 +0100)
src/rps/gnunet-rps-profiler.c
src/rps/rps_api.c

index f2a8083e76a63eca02ba75854a78f301cd6628a9..c0059ac3be85ab107d9414862a9af9cf3e432e5f 100644 (file)
@@ -909,6 +909,7 @@ cancel_request (struct PendingReply *pending_rep)
   rps_peer->num_pending_reps--;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Cancelling rps get reply\n");
+  GNUNET_assert (NULL != pending_rep->req_handle);
   GNUNET_RPS_request_cancel (pending_rep->req_handle);
   GNUNET_free (pending_rep);
 }
@@ -1288,7 +1289,11 @@ rps_disconnect_adapter (void *cls,
       cancel_request (pending_rep);
     }
     GNUNET_assert (h == peer->rps_handle);
-    GNUNET_RPS_disconnect (h);
+    if (NULL != h)
+    {
+      GNUNET_RPS_disconnect (h);
+      h = NULL;
+    }
     peer->rps_handle = NULL;
   }
 }
@@ -1788,6 +1793,7 @@ profiler_reply_handle (void *cls,
   unsigned int i;
   struct PendingReply *pending_rep = (struct PendingReply *) cls;
 
+  pending_rep->req_handle = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "profiler_reply_handle()\n");
   rps_peer = pending_rep->rps_peer;
   (void) GNUNET_asprintf (&file_name,
index bce56767826d8bd45a3368c435ba92215d238d1f..cfab06f17a37ae07c741de345285fae3ce93ec58 100644 (file)
@@ -854,6 +854,7 @@ GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh)
   struct GNUNET_RPS_Handle *h;
 
   h = rh->rps_handle;
+  GNUNET_assert (NULL != rh);
   GNUNET_assert (NULL != rh->srh);
   remove_stream_request (rh->srh,
                          h->stream_requests_head,