MCPcopy Create free account
hub / github.com/LabPy/lantz / do_call

Method do_call

lantz/drivers/legacy/rpc.py:328–356  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

326 self.sock.close()
327
328 def do_call(self):
329 call = self.packer.get_buf()
330 self.sock.send(call)
331 try:
332 from select import select
333 except ImportError:
334 print('WARNING: select not found, RPC may hang')
335 select = None
336 BUFSIZE = 8192 # Max UDP buffer size
337 timeout = 1
338 count = 5
339 while 1:
340 r, w, x = [self.sock], [], []
341 if select:
342 r, w, x = select(r, w, x, timeout)
343 if self.sock not in r:
344 count = count - 1
345 if count < 0: raise RPCError('timeout')
346 if timeout < 25:
347 timeout = timeout *2
348 self.sock.send(call)
349 continue
350 reply = self.sock.recv(BUFSIZE)
351 u = self.unpacker
352 u.reset(reply)
353 xid, verf = u.unpack_replyheader()
354 if xid != self.lastxid:
355 continue
356 break
357
358
359class RawBroadcastUDPClient(RawUDPClient):

Callers

nothing calls this directly

Calls 5

RPCErrorClass · 0.85
unpack_replyheaderMethod · 0.80
sendMethod · 0.45
recvMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected