summaryrefslogtreecommitdiff
path: root/designate/mdns/notify.py
diff options
context:
space:
mode:
Diffstat (limited to 'designate/mdns/notify.py')
-rw-r--r--designate/mdns/notify.py24
1 files changed, 4 insertions, 20 deletions
diff --git a/designate/mdns/notify.py b/designate/mdns/notify.py
index 0d66970d..0e464960 100644
--- a/designate/mdns/notify.py
+++ b/designate/mdns/notify.py
@@ -28,6 +28,7 @@ import dns.opcode
from oslo_config import cfg
from oslo_log import log as logging
+from designate import dnsutils
from designate.mdns import base
from designate.metrics import metrics
@@ -186,8 +187,9 @@ class NotifyEndpoint(base.BaseEndpoint):
'zone': zone.name, 'server': host,
'port': port})
try:
- response = self._send_dns_message(dns_message, host, port,
- timeout)
+ response = dnsutils.send_dns_message(
+ dns_message, host, port, timeout=timeout
+ )
except socket.error as e:
if e.errno != socket.errno.EAGAIN:
@@ -285,21 +287,3 @@ class NotifyEndpoint(base.BaseEndpoint):
dns_message.flags |= dns.flags.RD
return dns_message
-
- def _send_dns_message(self, dns_message, host, port, timeout):
- """
- Send DNS Message over TCP or UDP, return response.
-
- :param dns_message: The dns message that needs to be sent.
- :param host: The destination ip of dns_message.
- :param port: The destination port of dns_message.
- :param timeout: The timeout in seconds to wait for a response.
- :return: response
- """
- send = dns_query.tcp if CONF['service:mdns'].all_tcp else dns_query.udp
- return send(
- dns_message,
- socket.gethostbyname(host),
- port=port,
- timeout=timeout
- )