Correct a possible DNSService connection leak
There was a potential codepath where, if after parsing a packet, an exception was raused, we may leave TCP sockets around without explicitly closing them Change-Id: I6d619d05c7d0250cb5ae55212129e0d849c66c9d
This commit is contained in:
parent
0c034d1c8a
commit
4a68605bc8
@ -340,15 +340,16 @@ class DNSService(object):
|
|||||||
# Handle UDP Responses
|
# Handle UDP Responses
|
||||||
self._dns_sock_udp.sendto(response, addr)
|
self._dns_sock_udp.sendto(response, addr)
|
||||||
|
|
||||||
# Close the TCP connection if we have one.
|
|
||||||
if client:
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_LE("Unhandled exception while processing request "
|
LOG.exception(_LE("Unhandled exception while processing request "
|
||||||
"from %(host)s:%(port)d") %
|
"from %(host)s:%(port)d") %
|
||||||
{'host': addr[0], 'port': addr[1]})
|
{'host': addr[0], 'port': addr[1]})
|
||||||
|
|
||||||
|
# Close the TCP connection if we have one.
|
||||||
|
if client:
|
||||||
|
client.close()
|
||||||
|
|
||||||
|
|
||||||
_launcher = None
|
_launcher = None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user