Revision 8496d93c
b/lib/confd/client.py | ||
---|---|---|
185 | 185 |
@param args: additional callback arguments |
186 | 186 |
@type coverage: integer |
187 | 187 |
@param coverage: number of remote nodes to contact |
188 |
@type async: boolean |
|
189 |
@param async: handle the write asynchronously |
|
188 | 190 |
|
189 | 191 |
""" |
190 | 192 |
if coverage is None: |
... | ... | |
220 | 222 |
expire_time = now + constants.CONFD_CLIENT_EXPIRE_TIMEOUT |
221 | 223 |
self._expire_requests.append((expire_time, request.rsalt)) |
222 | 224 |
|
225 |
if not async: |
|
226 |
self.FlushSendQueue() |
|
227 |
|
|
223 | 228 |
def HandleResponse(self, payload, ip, port): |
224 | 229 |
"""Asynchronous handler for a confd reply |
225 | 230 |
|
... | ... | |
255 | 260 |
finally: |
256 | 261 |
self.ExpireRequests() |
257 | 262 |
|
263 |
def FlushSendQueue(self): |
|
264 |
"""Send out all pending requests. |
|
265 |
|
|
266 |
Can be used for synchronous client use. |
|
267 |
|
|
268 |
""" |
|
269 |
while self._socket.writable(): |
|
270 |
self._socket.handle_write() |
|
271 |
|
|
272 |
def ReceiveReply(self, timeout=1): |
|
273 |
"""Receive one reply. |
|
274 |
|
|
275 |
@type timeout: float |
|
276 |
@param timeout: how long to wait for the reply |
|
277 |
@rtype: boolean |
|
278 |
@return: True if some data has been handled, False otherwise |
|
279 |
|
|
280 |
""" |
|
281 |
return self._socket.process_next_packet(timeout=timeout) |
|
282 |
|
|
258 | 283 |
|
259 | 284 |
# UPCALL_REPLY: server reply upcall |
260 | 285 |
# has all ConfdUpcallPayload fields populated |
Also available in: Unified diff