MCPcopy
hub / github.com/shadowsocks/shadowsocks / _call_callback

Method _call_callback

shadowsocks/asyncdns.py:330–343  ·  view source on GitHub ↗
(self, hostname, ip, error=None)

Source from the content-addressed store, hash-verified

328 loop.add_periodic(self.handle_periodic)
329
330 def _call_callback(self, hostname, ip, error=None):
331 callbacks = self._hostname_to_cb.get(hostname, [])
332 for callback in callbacks:
333 if callback in self._cb_to_hostname:
334 del self._cb_to_hostname[callback]
335 if ip or error:
336 callback((hostname, ip), error)
337 else:
338 callback((hostname, None),
339 Exception('unknown hostname %s' % hostname))
340 if hostname in self._hostname_to_cb:
341 del self._hostname_to_cb[hostname]
342 if hostname in self._hostname_status:
343 del self._hostname_status[hostname]
344
345 def _handle_data(self, data):
346 response = parse_response(data)

Callers 1

_handle_dataMethod · 0.95

Calls 2

callbackFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected