Revision b11780bb

b/lib/daemon.py
72 72
    sched.scheduler.__init__(self, timefunc, AsyncoreDelayFunction)
73 73

  
74 74

  
75
class AsyncUDPSocket(asyncore.dispatcher):
75
class GanetiBaseAsyncoreDispatcher(asyncore.dispatcher):
76
  """Base Ganeti Asyncore Dispacher
77

  
78
  """
79
  # this method is overriding an asyncore.dispatcher method
80
  def handle_error(self):
81
    """Log an error in handling any request, and proceed.
82

  
83
    """
84
    logging.exception("Error while handling asyncore request")
85

  
86
  # this method is overriding an asyncore.dispatcher method
87
  def writable(self):
88
    """Most of the time we don't want to check for writability.
89

  
90
    """
91
    return False
92

  
93

  
94
class AsyncUDPSocket(GanetiBaseAsyncoreDispatcher):
76 95
  """An improved asyncore udp socket.
77 96

  
78 97
  """
......
80 99
    """Constructor for AsyncUDPSocket
81 100

  
82 101
    """
83
    asyncore.dispatcher.__init__(self)
102
    GanetiBaseAsyncoreDispatcher.__init__(self)
84 103
    self._out_queue = []
85 104
    self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)
86 105

  
......
119 138
    utils.IgnoreSignals(self.sendto, payload, 0, (ip, port))
120 139
    self._out_queue.pop(0)
121 140

  
122
  # this method is overriding an asyncore.dispatcher method
123
  def handle_error(self):
124
    """Log an error in handling any request, and proceed.
125

  
126
    """
127
    logging.exception("Error while handling asyncore request")
128

  
129 141
  def enqueue_send(self, ip, port, payload):
130 142
    """Enqueue a datagram to be sent when possible
131 143

  

Also available in: Unified diff