Revision 6ddf5c8f lib/daemon.py

b/lib/daemon.py
30 30
import sched
31 31
import time
32 32
import socket
33
import select
33 34
import sys
34 35

  
35 36
from ganeti import utils
......
156 157
                                    constants.MAX_UDP_DATA_SIZE))
157 158
    self._out_queue.append((ip, port, payload))
158 159

  
160
  def process_next_packet(self, timeout=0):
161
    """Process the next datagram, waiting for it if necessary.
162

  
163
    @type timeout: float
164
    @param timeout: how long to wait for data
165
    @rtype: boolean
166
    @return: True if some data has been handled, False otherwise
167

  
168
    """
169
    if utils.WaitForFdCondition(self, select.POLLIN, timeout) & select.POLLIN:
170
      self.do_read()
171
      return True
172
    else:
173
      return False
174

  
159 175

  
160 176
class Mainloop(object):
161 177
  """Generic mainloop for daemons

Also available in: Unified diff