From kde-commits Sat Oct 24 14:53:53 2009 From: Oswald Buddenhagen Date: Sat, 24 Oct 2009 14:53:53 +0000 To: kde-commits Subject: icecream/services Message-Id: <1256396033.068918.11369.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125639603908571 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);