def _add (method, url, params = None, auth = None, headers = {}, callback = None, meta = None, proxy = None):
global _que, _initialized, _dns_query_req, _dns_reqs, _workers
if not _initialized:
configure ()
if not meta:
meta = {}
meta ['req_id'] = _que.req_id
meta ['req_method'] = method
meta ['req_callback'] = callback
_que.add ((method, url, params, auth, headers, meta, proxy))
# DNS query for caching and massive
if not lifetime._polling:
host = urlparse (url) [1].split (":")[0]
if _dns_reqs < _workers and host not in _dns_query_req:
_dns_query_req [host] = None
_dns_reqs += 1
adns.query (host, "A", callback = lambda x: None)
asyndns.pop_all ()
asyncore.loop (0.1, count = 2)
#print ('~~~~~~~~~~~~~~~', asyndns.pool.connections)
#----------------------------------------------------
# Add Reuqest (protocols.*.request) Object
#----------------------------------------------------
评论列表
文章目录