aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_unix.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-23 16:01:08 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-23 16:01:08 +0000
commit308efe05ba94066c13062679089d9efe2fc22ee9 (patch)
tree2a87c2fc9ad881aa13edbc21e940d57be2207b87 /src/transport/plugin_transport_unix.c
parent20b08238cff253267172403149bfea1b9c66f499 (diff)
downloadgnunet-308efe05ba94066c13062679089d9efe2fc22ee9.tar.gz
gnunet-308efe05ba94066c13062679089d9efe2fc22ee9.zip
fix to the 100% CPU load problem
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r--src/transport/plugin_transport_unix.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index e5ada0490..317ff2089 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -549,6 +549,18 @@ unix_plugin_get_session (void *cls,
549 return s; 549 return s;
550} 550}
551 551
552/*
553 * @param cls the plugin handle
554 * @param tc the scheduling context (for rescheduling this function again)
555 *
556 * We have been notified that our writeset has something to read. We don't
557 * know which socket needs to be read, so we have to check each one
558 * Then reschedule this function to be called again once more is available.
559 *
560 */
561static void
562unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
563
552/** 564/**
553 * Function that can be used by the transport service to transmit 565 * Function that can be used by the transport service to transmit
554 * a message using the plugin. Note that in the case of a 566 * a message using the plugin. Note that in the case of a
@@ -623,6 +635,17 @@ unix_plugin_send (void *cls,
623 (char *) session->addr); 635 (char *) session->addr);
624#endif 636#endif
625 637
638 if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
639 GNUNET_SCHEDULER_cancel(plugin->select_task);
640
641 plugin->select_task =
642 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
643 GNUNET_SCHEDULER_NO_TASK,
644 GNUNET_TIME_UNIT_FOREVER_REL,
645 plugin->rs,
646 plugin->ws,
647 &unix_plugin_select, plugin);
648
626 return ssize; 649 return ssize;
627} 650}
628 651
@@ -803,8 +826,10 @@ unix_plugin_select (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
803 plugin->select_task = 826 plugin->select_task =
804 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 827 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
805 GNUNET_SCHEDULER_NO_TASK, 828 GNUNET_SCHEDULER_NO_TASK,
806 GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, 829 GNUNET_TIME_UNIT_FOREVER_REL,
807 plugin->ws, &unix_plugin_select, plugin); 830 plugin->rs,
831 (plugin->msg_head != NULL) ? plugin->ws : NULL,
832 &unix_plugin_select, plugin);
808} 833}
809 834
810/** 835/**