hgext/zeroconf/Zeroconf.py
changeset 42551 8306b6c29add
parent 42550 683aeef12830
child 43076 2372284d9457
equal deleted inserted replaced
42550:683aeef12830 42551:8306b6c29add
    86 import socket
    86 import socket
    87 import struct
    87 import struct
    88 import threading
    88 import threading
    89 import time
    89 import time
    90 import traceback
    90 import traceback
       
    91 
       
    92 from mercurial import pycompat
    91 
    93 
    92 __all__ = ["Zeroconf", "ServiceInfo", "ServiceBrowser"]
    94 __all__ = ["Zeroconf", "ServiceInfo", "ServiceBrowser"]
    93 
    95 
    94 # hook for threads
    96 # hook for threads
    95 
    97 
   268 
   270 
   269 class DNSQuestion(DNSEntry):
   271 class DNSQuestion(DNSEntry):
   270     """A DNS question entry"""
   272     """A DNS question entry"""
   271 
   273 
   272     def __init__(self, name, type, clazz):
   274     def __init__(self, name, type, clazz):
       
   275         if pycompat.ispy3 and isinstance(name, str):
       
   276             name = name.encode('ascii')
   273         if not name.endswith(".local."):
   277         if not name.endswith(".local."):
   274             raise NonLocalNameException(name)
   278             raise NonLocalNameException(name)
   275         DNSEntry.__init__(self, name, type, clazz)
   279         DNSEntry.__init__(self, name, type, clazz)
   276 
   280 
   277     def answeredBy(self, rec):
   281     def answeredBy(self, rec):