changeset 8131:b0d945b95105

zeroconf: don't fail on non-local names
author Alexander Solovyov <piranha@piranha.org.ua>
date Mon, 13 Apr 2009 21:23:52 +0300
parents 0f505bc1c3c3
children cece135ffcf0
files hgext/zeroconf/Zeroconf.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/zeroconf/Zeroconf.py	Thu Apr 23 15:39:54 2009 -0500
+++ b/hgext/zeroconf/Zeroconf.py	Mon Apr 13 21:23:52 2009 +0300
@@ -259,7 +259,7 @@
 
 	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 @@
 			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"""