Mailinglist Archive: yast-commit (870 mails)

< Previous Next >
[yast-commit] r49152 - in /branches/tmp/lslezak/workshop/core/scr/src: DBusServer.cc PolKit.cc
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Wed, 16 Jul 2008 11:22:31 -0000
  • Message-id: <20080716112235.B5A842738C@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Wed Jul 16 13:22:31 2008
New Revision: 49152

URL: http://svn.opensuse.org/viewcvs/yast?rev=49152&view=rev
Log:
- use nanosleep() - more finegrained sleeping

Modified:
branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc
branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc

Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc?rev=49152&r1=49151&r2=49152&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc Wed Jul 16
13:22:31 2008
@@ -14,6 +14,9 @@

#include <ycp/y2log.h>

+// nanosleep
+#include <time.h>
+

DBusServer::DBusServer()
{
@@ -42,6 +45,13 @@
void DBusServer::run()
{
y2milestone("Listening for incoming DBus messages...");
+ timespec req, rem;
+
+ // TODO: use some better mechanism (e.g. file descriptor watch) instead of
polling
+ // 0 seconds
+ req.tv_sec = 0;
+ // 50 miliseconds
+ req.tv_nsec = 50000000;

// mainloop
while (true)
@@ -54,7 +64,7 @@
// check if a message was received
if (request.empty())
{
- sleep(1);
+ nanosleep(&req, &rem);
continue;
}


Modified: branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc?rev=49152&r1=49151&r2=49152&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc Wed Jul 16 13:22:31
2008
@@ -54,7 +54,7 @@
return pk_result == POLKIT_RESULT_YES;
}

-std::string toLower(const std::string &s)
+std::string makeValidActionID(const std::string &s)
{
if (s.empty())
return s;
@@ -90,8 +90,10 @@
{
std::string action_id(prefix + path + "." + method);

+ // TODO: use arg and opt for gereric agents (like .target.bash) to allow
only some arguments
+
// TODO actionID must contain only [a-z][0-9] and .- characters, max.
length is 255 characters
- action_id = toLower(action_id);
+ action_id = makeValidActionID(action_id);

return action_id;
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages