'NoneType' object is not subscriptable
Closed this issue · 1 comments
mzealey commented
in on_answer
occasionally we cannot get the client ip address - line:
clientip = self.transport.get_extra_info('peername')[0]
Not too sure why this would be but as I think it's only for logging it probably makes sense to only try doing this if we are logging anyway?
future: <Task finished name='Task-670' coro=<H2Protocol.resolve() done, defined at /usr/lib/python3.8/site-packages/doh_proxy-0.0.9-py3.8.egg/dohproxy/proxy.py:207> exception=TypeError("'NoneType' object is not subscriptable")>
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/doh_proxy-0.0.9-py3.8.egg/dohproxy/proxy.py", line 216, in resolve
self.on_answer(stream_id, dnsr=dnsr)
File "/usr/lib/python3.8/site-packages/doh_proxy-0.0.9-py3.8.egg/dohproxy/proxy.py", line 188, in on_answer
clientip = self.transport.get_extra_info('peername')[0]
TypeError: 'NoneType' object is not subscriptable
chantra commented
Hi,
Sorry for the last reply, I missed this issue.
It looks like what happens is that by the time we finished resolving, the socket on the other end was closed and peername
become None.