check for existing task
authorChristian Grothoff <christian@grothoff.org>
Tue, 7 Jun 2016 14:48:05 +0000 (14:48 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 7 Jun 2016 14:48:05 +0000 (14:48 +0000)
src/curl/curl_reschedule.c

index fab66765e61aa30fec75647afa1690c0bce5d18e..6da930ea068a62aec434d6d176ca8bf9ac2d4642 100644 (file)
@@ -116,12 +116,13 @@ context_task (void *cls)
   GNUNET_NETWORK_fdset_copy_native (ws,
                                     &write_fd_set,
                                     max_fd + 1);
-  rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                          delay,
-                                          rs,
-                                          ws,
-                                          &context_task,
-                                          rc);
+  if (NULL == rc->task)
+    rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+                                            delay,
+                                            rs,
+                                            ws,
+                                            &context_task,
+                                            rc);
   GNUNET_NETWORK_fdset_destroy (rs);
   GNUNET_NETWORK_fdset_destroy (ws);
 }