Browse Source

(refactor) Less duplication and more sure that the upstream queue won't block forever

main
Michal Charemza 5 years ago
parent
commit
b01a8996f1
No known key found for this signature in database GPG Key ID: 4BBAF0F6B73C4363
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      dnsrewriteproxy.py

+ 4
- 4
dnsrewriteproxy.py View File

@@ -111,11 +111,11 @@ def DnsProxy(
response_data = await get_response_data(resolve, request_data)
except Exception:
logger.exception('Exception from handler_request_data %s', addr)
upstream_queue.task_done()
continue

await downstream_queue.put((response_data, addr))
upstream_queue.task_done()
else:
await downstream_queue.put((response_data, addr))
finally:
upstream_queue.task_done()

async def downstream_worker(sock, downstream_queue):
while True:


Loading…
Cancel
Save