[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream/services
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2009-10-24 14:53:53
Message-ID: 1256396033.068918.11369.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1039763 by ossi:

allow get_msg() to fetch data from the kernel even if timeout is 0.

after all, no timeout means that it may not wait for new packets, not
that only userspace buffers can be checked for available data.

 M  +9 -4      comm.cpp  
 M  +1 -1      comm.h  


--- trunk/icecream/services/comm.cpp #1039762:1039763
@@ -850,11 +850,16 @@
 {
   if (has_msg ())
     return true;
-  if (!read_a_bit () || timeout <= 0)
+  if (!read_a_bit ())
     {
-      trace() << "!read_a_bit || timeout <= 0\n";
+      trace() << "!read_a_bit\n";
       return false;
     }
+  if (timeout <= 0)
+    {
+      trace() << "timeout <= 0\n";
+      return has_msg ();
+    }
   while (!has_msg ())
     {
       fd_set read_set;
@@ -884,8 +889,8 @@
   Msg *m = 0;
   enum MsgType type;
   uint32_t t;
-  if (timeout > 0 && !wait_for_msg (timeout) ) {
-    trace() << "blocking && !waiting_for_msg()\n";
+  if (!wait_for_msg (timeout) ) {
+    trace() << "!wait_for_msg()\n";
     return 0;
   }
   /* If we've seen the EOF, and we don't have a complete message,
--- trunk/icecream/services/comm.h #1039762:1039763
@@ -154,7 +154,7 @@
   void setBulkTransfer();
 
   std::string dump() const;
-  // NULL  <--> channel closed
+  // NULL  <--> channel closed or timeout
   Msg *get_msg(int timeout = 10);
   // false <--> error (msg not send)
   bool send_msg (const Msg &, int SendFlags = SendBlocking);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic