gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19975 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r19975 - gnunet/src/transport
Date: Thu, 23 Feb 2012 17:01:08 +0100

Author: wachs
Date: 2012-02-23 17:01:08 +0100 (Thu, 23 Feb 2012)
New Revision: 19975

Modified:
   gnunet/src/transport/plugin_transport_unix.c
Log:
fix to the 100% CPU load problem


Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2012-02-23 15:34:23 UTC 
(rev 19974)
+++ gnunet/src/transport/plugin_transport_unix.c        2012-02-23 16:01:08 UTC 
(rev 19975)
@@ -549,6 +549,18 @@
   return s;
 }
 
+/*
+ * @param cls the plugin handle
+ * @param tc the scheduling context (for rescheduling this function again)
+ *
+ * We have been notified that our writeset has something to read.  We don't
+ * know which socket needs to be read, so we have to check each one
+ * Then reschedule this function to be called again once more is available.
+ *
+ */
+static void
+unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+
 /**
  * Function that can be used by the transport service to transmit
  * a message using the plugin.   Note that in the case of a
@@ -623,6 +635,17 @@
               (char *) session->addr);
 #endif
 
+  if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
+    GNUNET_SCHEDULER_cancel(plugin->select_task);
+
+  plugin->select_task =
+      GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+                                   GNUNET_SCHEDULER_NO_TASK,
+                                   GNUNET_TIME_UNIT_FOREVER_REL,
+                                   plugin->rs,
+                                   plugin->ws,
+                                   &unix_plugin_select, plugin);
+
   return ssize;
 }
 
@@ -803,8 +826,10 @@
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
                                    GNUNET_SCHEDULER_NO_TASK,
-                                   GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs,
-                                   plugin->ws, &unix_plugin_select, plugin);
+                                   GNUNET_TIME_UNIT_FOREVER_REL,
+                                   plugin->rs,
+                                   (plugin->msg_head != NULL) ? plugin->ws : 
NULL,
+                                   &unix_plugin_select, plugin);
 }
 
 /**




reply via email to

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