[PATCH 1 of 1] zeroconf: don't fail on non-local names

Alexander Solovyov piranha at piranha.org.ua
Mon Apr 13 13:59:28 CDT 2009


# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1239647032 -10800
# Node ID 84c3941152811f4ea90b1f0f127c22f1e1fa7280
# Parent  fe2a87a3d344878982641110dd26f2949a0b6fff
zeroconf: don't fail on non-local names

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -259,7 +259,7 @@ class DNSQuestion(DNSEntry):
 
 	def __init__(self, name, type, clazz):
 		if not name.endswith(".local."):
-			raise NonLocalNameException
+			raise NonLocalNameException(name)
 		DNSEntry.__init__(self, name, type, clazz)
 
 	def answeredBy(self, rec):
@@ -492,8 +492,11 @@ class DNSIncoming(object):
 			info = struct.unpack(format, self.data[self.offset:self.offset+length])
 			self.offset += length
 
-			question = DNSQuestion(name, info[0], info[1])
-			self.questions.append(question)
+			try:
+				question = DNSQuestion(name, info[0], info[1])
+				self.questions.append(question)
+			except NonLocalNameException:
+				pass
 
 	def readInt(self):
 		"""Reads an integer from the packet"""


More information about the Mercurial-devel mailing list