MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / poll_once

Method poll_once

src/lib/subtl/subtl.py:81–99  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

79 return trans
80
81 def poll_once(self):
82 self.sock.settimeout(self.timeout)
83 try:
84 response = self.sock.recv(10240)
85 except socket.timeout:
86 return
87
88 header = response[:8]
89 payload = response[8:]
90 action, trans_id = struct.unpack('!LL', header)
91 try:
92 trans = self.transactions[trans_id]
93 except KeyError:
94 self.error('transaction_id not found')
95 return
96 trans['response'] = self._process_response(action, payload, trans)
97 trans['completed'] = True
98 del self.transactions[trans_id]
99 return trans
100
101 def error(self, message):
102 raise Exception('error: {}'.format(message))

Callers 1

announceTrackerUdpMethod · 0.95

Calls 3

errorMethod · 0.95
_process_responseMethod · 0.95
unpackMethod · 0.45

Tested by

no test coverage detected