Merge "Handle unhandled exception in dnsutils.py for py3"
This commit is contained in:
commit
59fe84d00c
|
@ -123,6 +123,14 @@ class SerializationMiddleware(DNSMiddleware):
|
|||
|
||||
response = self._build_error_response()
|
||||
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unknown exception deserializing packet "
|
||||
"from %(host)s %(port)d") %
|
||||
{'host': request['addr'][0],
|
||||
'port': request['addr'][1]})
|
||||
|
||||
response = self._build_error_response()
|
||||
|
||||
else:
|
||||
# Hand the Deserialized packet onto the Application
|
||||
for response in self.application(message):
|
||||
|
|
|
@ -39,7 +39,7 @@ class MdnsServiceTest(MdnsTestCase):
|
|||
|
||||
@mock.patch.object(dns.message, 'make_query')
|
||||
def test_handle_empty_payload(self, query_mock):
|
||||
self.service._dns_handle(self.addr, None)
|
||||
self.service._dns_handle(self.addr, ' '.encode('utf-8'))
|
||||
query_mock.assert_called_once_with('unknown', dns.rdatatype.A)
|
||||
|
||||
@mock.patch.object(socket.socket, 'sendto', new_callable=mock.MagicMock)
|
||||
|
|
Loading…
Reference in New Issue