##// END OF EJS Templates
cleanup: whitespace cleanup
Peter Arrenbrecht -
r7877:eba7f12b default
parent child Browse files
Show More
@@ -188,11 +188,11 b' class converter(object):'
188 def writeauthormap(self):
188 def writeauthormap(self):
189 authorfile = self.authorfile
189 authorfile = self.authorfile
190 if authorfile:
190 if authorfile:
191 self.ui.status(_('Writing author map file %s\n') % authorfile)
191 self.ui.status(_('Writing author map file %s\n') % authorfile)
192 ofile = open(authorfile, 'w+')
192 ofile = open(authorfile, 'w+')
193 for author in self.authors:
193 for author in self.authors:
194 ofile.write("%s=%s\n" % (author, self.authors[author]))
194 ofile.write("%s=%s\n" % (author, self.authors[author]))
195 ofile.close()
195 ofile.close()
196
196
197 def readauthormap(self, authorfile):
197 def readauthormap(self, authorfile):
198 afile = open(authorfile, 'r')
198 afile = open(authorfile, 'r')
@@ -155,35 +155,33 b' class mercurial_sink(converter_sink):'
155 return p2
155 return p2
156
156
157 def puttags(self, tags):
157 def puttags(self, tags):
158 try:
158 try:
159 parentctx = self.repo[self.tagsbranch]
159 parentctx = self.repo[self.tagsbranch]
160 tagparent = parentctx.node()
160 tagparent = parentctx.node()
161 except error.RepoError:
161 except error.RepoError:
162 parentctx = None
162 parentctx = None
163 tagparent = nullid
163 tagparent = nullid
164
164
165 try:
165 try:
166 oldlines = util.sort(parentctx['.hgtags'].data().splitlines(1))
166 oldlines = util.sort(parentctx['.hgtags'].data().splitlines(1))
167 except:
167 except:
168 oldlines = []
168 oldlines = []
169
169
170 newlines = util.sort([("%s %s\n" % (tags[tag], tag)) for tag in tags])
170 newlines = util.sort([("%s %s\n" % (tags[tag], tag)) for tag in tags])
171
171 if newlines == oldlines:
172 if newlines == oldlines:
172 return None
173 return None
173 data = "".join(newlines)
174 data = "".join(newlines)
174 def getfilectx(repo, memctx, f):
175
176 def getfilectx(repo, memctx, f):
177 return context.memfilectx(f, data, False, False, None)
175 return context.memfilectx(f, data, False, False, None)
178
176
179 self.ui.status(_("updating tags\n"))
177 self.ui.status(_("updating tags\n"))
180 date = "%s 0" % int(time.mktime(time.gmtime()))
178 date = "%s 0" % int(time.mktime(time.gmtime()))
181 extra = {'branch': self.tagsbranch}
179 extra = {'branch': self.tagsbranch}
182 ctx = context.memctx(self.repo, (tagparent, None), "update tags",
180 ctx = context.memctx(self.repo, (tagparent, None), "update tags",
183 [".hgtags"], getfilectx, "convert-repo", date,
181 [".hgtags"], getfilectx, "convert-repo", date,
184 extra)
182 extra)
185 self.repo.commitctx(ctx)
183 self.repo.commitctx(ctx)
186 return hex(self.repo.changelog.tip())
184 return hex(self.repo.changelog.tip())
187
185
188 def setfilemapmode(self, active):
186 def setfilemapmode(self, active):
189 self.filemapmode = active
187 self.filemapmode = active
@@ -340,7 +340,7 b' def buildstate(repo, dest, src, base, co'
340 targetancestors = util.set()
340 targetancestors = util.set()
341
341
342 if not dest:
342 if not dest:
343 # Destination defaults to the latest revision in the current branch
343 # Destination defaults to the latest revision in the current branch
344 branch = repo[None].branch()
344 branch = repo[None].branch()
345 dest = repo[branch].rev()
345 dest = repo[branch].rev()
346 else:
346 else:
@@ -46,54 +46,54 b' from mercurial.i18n import _'
46 from mercurial import util
46 from mercurial import util
47
47
48 def decode(arg):
48 def decode(arg):
49 if isinstance(arg, str):
49 if isinstance(arg, str):
50 uarg = arg.decode(util._encoding)
50 uarg = arg.decode(util._encoding)
51 if arg == uarg.encode(util._encoding):
51 if arg == uarg.encode(util._encoding):
52 return uarg
52 return uarg
53 raise UnicodeError("Not local encoding")
53 raise UnicodeError("Not local encoding")
54 elif isinstance(arg, tuple):
54 elif isinstance(arg, tuple):
55 return tuple(map(decode, arg))
55 return tuple(map(decode, arg))
56 elif isinstance(arg, list):
56 elif isinstance(arg, list):
57 return map(decode, arg)
57 return map(decode, arg)
58 return arg
58 return arg
59
59
60 def encode(arg):
60 def encode(arg):
61 if isinstance(arg, unicode):
61 if isinstance(arg, unicode):
62 return arg.encode(util._encoding)
62 return arg.encode(util._encoding)
63 elif isinstance(arg, tuple):
63 elif isinstance(arg, tuple):
64 return tuple(map(encode, arg))
64 return tuple(map(encode, arg))
65 elif isinstance(arg, list):
65 elif isinstance(arg, list):
66 return map(encode, arg)
66 return map(encode, arg)
67 return arg
67 return arg
68
68
69 def wrapper(func, args):
69 def wrapper(func, args):
70 # check argument is unicode, then call original
70 # check argument is unicode, then call original
71 for arg in args:
71 for arg in args:
72 if isinstance(arg, unicode):
72 if isinstance(arg, unicode):
73 return func(*args)
73 return func(*args)
74
74
75 try:
75 try:
76 # convert arguments to unicode, call func, then convert back
76 # convert arguments to unicode, call func, then convert back
77 return encode(func(*decode(args)))
77 return encode(func(*decode(args)))
78 except UnicodeError:
78 except UnicodeError:
79 # If not encoded with util._encoding, report it then
79 # If not encoded with util._encoding, report it then
80 # continue with calling original function.
80 # continue with calling original function.
81 raise util.Abort(_("[win32mbcs] filename conversion fail with"
81 raise util.Abort(_("[win32mbcs] filename conversion fail with"
82 " %s encoding\n") % (util._encoding))
82 " %s encoding\n") % (util._encoding))
83
83
84 def wrapname(name):
84 def wrapname(name):
85 idx = name.rfind('.')
85 idx = name.rfind('.')
86 module = name[:idx]
86 module = name[:idx]
87 name = name[idx+1:]
87 name = name[idx+1:]
88 module = eval(module)
88 module = eval(module)
89 func = getattr(module, name)
89 func = getattr(module, name)
90 def f(*args):
90 def f(*args):
91 return wrapper(func, args)
91 return wrapper(func, args)
92 try:
92 try:
93 f.__name__ = func.__name__ # fail with python23
93 f.__name__ = func.__name__ # fail with python23
94 except Exception:
94 except Exception:
95 pass
95 pass
96 setattr(module, name, f)
96 setattr(module, name, f)
97
97
98 # List of functions to be wrapped.
98 # List of functions to be wrapped.
99 # NOTE: os.path.dirname() and os.path.basename() are safe because
99 # NOTE: os.path.dirname() and os.path.basename() are safe because
@@ -109,14 +109,14 b" problematic_encodings = '''big5 big5-tw "
109 shift_jisx0213 shiftjisx0213 sjisx0213 s_jisx0213'''
109 shift_jisx0213 shiftjisx0213 sjisx0213 s_jisx0213'''
110
110
111 def reposetup(ui, repo):
111 def reposetup(ui, repo):
112 # TODO: decide use of config section for this extension
112 # TODO: decide use of config section for this extension
113 if not os.path.supports_unicode_filenames:
113 if not os.path.supports_unicode_filenames:
114 ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
114 ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
115 return
115 return
116
116
117 # fake is only for relevant environment.
117 # fake is only for relevant environment.
118 if util._encoding.lower() in problematic_encodings.split():
118 if util._encoding.lower() in problematic_encodings.split():
119 for f in funcs.split():
119 for f in funcs.split():
120 wrapname(f)
120 wrapname(f)
121 ui.debug(_("[win32mbcs] activated with encoding: %s\n") % util._encoding)
121 ui.debug(_("[win32mbcs] activated with encoding: %s\n") % util._encoding)
122
122
@@ -19,7 +19,7 b''
19 You should have received a copy of the GNU Lesser General Public
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
22
23 """
23 """
24
24
25 """0.12 update - allow selection of binding interface
25 """0.12 update - allow selection of binding interface
@@ -101,7 +101,7 b" globals()['_GLOBAL_DONE'] = 0"
101 _BROWSER_TIME = 500
101 _BROWSER_TIME = 500
102
102
103 # Some DNS constants
103 # Some DNS constants
104
104
105 _MDNS_ADDR = '224.0.0.251'
105 _MDNS_ADDR = '224.0.0.251'
106 _MDNS_PORT = 5353;
106 _MDNS_PORT = 5353;
107 _DNS_PORT = 53;
107 _DNS_PORT = 53;
@@ -208,7 +208,7 b' class BadTypeInNameException(Exception):'
208
208
209 class DNSEntry(object):
209 class DNSEntry(object):
210 """A DNS entry"""
210 """A DNS entry"""
211
211
212 def __init__(self, name, type, clazz):
212 def __init__(self, name, type, clazz):
213 self.key = string.lower(name)
213 self.key = string.lower(name)
214 self.name = name
214 self.name = name
@@ -256,7 +256,7 b' class DNSEntry(object):'
256
256
257 class DNSQuestion(DNSEntry):
257 class DNSQuestion(DNSEntry):
258 """A DNS question entry"""
258 """A DNS question entry"""
259
259
260 def __init__(self, name, type, clazz):
260 def __init__(self, name, type, clazz):
261 if not name.endswith(".local."):
261 if not name.endswith(".local."):
262 raise NonLocalNameException
262 raise NonLocalNameException
@@ -273,7 +273,7 b' class DNSQuestion(DNSEntry):'
273
273
274 class DNSRecord(DNSEntry):
274 class DNSRecord(DNSEntry):
275 """A DNS record - like a DNS entry, but has a TTL"""
275 """A DNS record - like a DNS entry, but has a TTL"""
276
276
277 def __init__(self, name, type, clazz, ttl):
277 def __init__(self, name, type, clazz, ttl):
278 DNSEntry.__init__(self, name, type, clazz)
278 DNSEntry.__init__(self, name, type, clazz)
279 self.ttl = ttl
279 self.ttl = ttl
@@ -334,7 +334,7 b' class DNSRecord(DNSEntry):'
334
334
335 class DNSAddress(DNSRecord):
335 class DNSAddress(DNSRecord):
336 """A DNS address record"""
336 """A DNS address record"""
337
337
338 def __init__(self, name, type, clazz, ttl, address):
338 def __init__(self, name, type, clazz, ttl, address):
339 DNSRecord.__init__(self, name, type, clazz, ttl)
339 DNSRecord.__init__(self, name, type, clazz, ttl)
340 self.address = address
340 self.address = address
@@ -378,10 +378,10 b' class DNSHinfo(DNSRecord):'
378 def __repr__(self):
378 def __repr__(self):
379 """String representation"""
379 """String representation"""
380 return self.cpu + " " + self.os
380 return self.cpu + " " + self.os
381
381
382 class DNSPointer(DNSRecord):
382 class DNSPointer(DNSRecord):
383 """A DNS pointer record"""
383 """A DNS pointer record"""
384
384
385 def __init__(self, name, type, clazz, ttl, alias):
385 def __init__(self, name, type, clazz, ttl, alias):
386 DNSRecord.__init__(self, name, type, clazz, ttl)
386 DNSRecord.__init__(self, name, type, clazz, ttl)
387 self.alias = alias
387 self.alias = alias
@@ -402,7 +402,7 b' class DNSPointer(DNSRecord):'
402
402
403 class DNSText(DNSRecord):
403 class DNSText(DNSRecord):
404 """A DNS text record"""
404 """A DNS text record"""
405
405
406 def __init__(self, name, type, clazz, ttl, text):
406 def __init__(self, name, type, clazz, ttl, text):
407 DNSRecord.__init__(self, name, type, clazz, ttl)
407 DNSRecord.__init__(self, name, type, clazz, ttl)
408 self.text = text
408 self.text = text
@@ -426,7 +426,7 b' class DNSText(DNSRecord):'
426
426
427 class DNSService(DNSRecord):
427 class DNSService(DNSRecord):
428 """A DNS service record"""
428 """A DNS service record"""
429
429
430 def __init__(self, name, type, clazz, ttl, priority, weight, port, server):
430 def __init__(self, name, type, clazz, ttl, priority, weight, port, server):
431 DNSRecord.__init__(self, name, type, clazz, ttl)
431 DNSRecord.__init__(self, name, type, clazz, ttl)
432 self.priority = priority
432 self.priority = priority
@@ -453,7 +453,7 b' class DNSService(DNSRecord):'
453
453
454 class DNSIncoming(object):
454 class DNSIncoming(object):
455 """Object representation of an incoming DNS packet"""
455 """Object representation of an incoming DNS packet"""
456
456
457 def __init__(self, data):
457 def __init__(self, data):
458 """Constructor from string holding bytes of packet"""
458 """Constructor from string holding bytes of packet"""
459 self.offset = 0
459 self.offset = 0
@@ -464,7 +464,7 b' class DNSIncoming(object):'
464 self.numAnswers = 0
464 self.numAnswers = 0
465 self.numAuthorities = 0
465 self.numAuthorities = 0
466 self.numAdditionals = 0
466 self.numAdditionals = 0
467
467
468 self.readHeader()
468 self.readHeader()
469 self.readQuestions()
469 self.readQuestions()
470 self.readOthers()
470 self.readOthers()
@@ -491,7 +491,7 b' class DNSIncoming(object):'
491 name = self.readName()
491 name = self.readName()
492 info = struct.unpack(format, self.data[self.offset:self.offset+length])
492 info = struct.unpack(format, self.data[self.offset:self.offset+length])
493 self.offset += length
493 self.offset += length
494
494
495 question = DNSQuestion(name, info[0], info[1])
495 question = DNSQuestion(name, info[0], info[1])
496 self.questions.append(question)
496 self.questions.append(question)
497
497
@@ -561,7 +561,7 b' class DNSIncoming(object):'
561
561
562 if rec is not None:
562 if rec is not None:
563 self.answers.append(rec)
563 self.answers.append(rec)
564
564
565 def isQuery(self):
565 def isQuery(self):
566 """Returns true if this is a query"""
566 """Returns true if this is a query"""
567 return (self.flags & _FLAGS_QR_MASK) == _FLAGS_QR_QUERY
567 return (self.flags & _FLAGS_QR_MASK) == _FLAGS_QR_QUERY
@@ -574,7 +574,7 b' class DNSIncoming(object):'
574 """Reads a UTF-8 string of a given length from the packet"""
574 """Reads a UTF-8 string of a given length from the packet"""
575 result = self.data[offset:offset+len].decode('utf-8')
575 result = self.data[offset:offset+len].decode('utf-8')
576 return result
576 return result
577
577
578 def readName(self):
578 def readName(self):
579 """Reads a domain name from the packet"""
579 """Reads a domain name from the packet"""
580 result = ''
580 result = ''
@@ -607,11 +607,11 b' class DNSIncoming(object):'
607 self.offset = off
607 self.offset = off
608
608
609 return result
609 return result
610
610
611
611
612 class DNSOutgoing(object):
612 class DNSOutgoing(object):
613 """Object representation of an outgoing packet"""
613 """Object representation of an outgoing packet"""
614
614
615 def __init__(self, flags, multicast = 1):
615 def __init__(self, flags, multicast = 1):
616 self.finished = 0
616 self.finished = 0
617 self.id = 0
617 self.id = 0
@@ -620,7 +620,7 b' class DNSOutgoing(object):'
620 self.names = {}
620 self.names = {}
621 self.data = []
621 self.data = []
622 self.size = 12
622 self.size = 12
623
623
624 self.questions = []
624 self.questions = []
625 self.answers = []
625 self.answers = []
626 self.authorities = []
626 self.authorities = []
@@ -660,7 +660,7 b' class DNSOutgoing(object):'
660 format = '!H'
660 format = '!H'
661 self.data.insert(index, struct.pack(format, value))
661 self.data.insert(index, struct.pack(format, value))
662 self.size += 2
662 self.size += 2
663
663
664 def writeShort(self, value):
664 def writeShort(self, value):
665 """Writes an unsigned short to the packet"""
665 """Writes an unsigned short to the packet"""
666 format = '!H'
666 format = '!H'
@@ -739,7 +739,7 b' class DNSOutgoing(object):'
739 self.size += 2
739 self.size += 2
740 record.write(self)
740 record.write(self)
741 self.size -= 2
741 self.size -= 2
742
742
743 length = len(''.join(self.data[index:]))
743 length = len(''.join(self.data[index:]))
744 self.insertShort(index, length) # Here is the short we adjusted for
744 self.insertShort(index, length) # Here is the short we adjusted for
745
745
@@ -758,7 +758,7 b' class DNSOutgoing(object):'
758 self.writeRecord(authority, 0)
758 self.writeRecord(authority, 0)
759 for additional in self.additionals:
759 for additional in self.additionals:
760 self.writeRecord(additional, 0)
760 self.writeRecord(additional, 0)
761
761
762 self.insertShort(0, len(self.additionals))
762 self.insertShort(0, len(self.additionals))
763 self.insertShort(0, len(self.authorities))
763 self.insertShort(0, len(self.authorities))
764 self.insertShort(0, len(self.answers))
764 self.insertShort(0, len(self.answers))
@@ -773,7 +773,7 b' class DNSOutgoing(object):'
773
773
774 class DNSCache(object):
774 class DNSCache(object):
775 """A cache of DNS entries"""
775 """A cache of DNS entries"""
776
776
777 def __init__(self):
777 def __init__(self):
778 self.cache = {}
778 self.cache = {}
779
779
@@ -870,7 +870,7 b' class Engine(threading.Thread):'
870 result = self.readers.keys()
870 result = self.readers.keys()
871 self.condition.release()
871 self.condition.release()
872 return result
872 return result
873
873
874 def addReader(self, reader, socket):
874 def addReader(self, reader, socket):
875 self.condition.acquire()
875 self.condition.acquire()
876 self.readers[socket] = reader
876 self.readers[socket] = reader
@@ -895,7 +895,7 b' class Listener(object):'
895
895
896 It requires registration with an Engine object in order to have
896 It requires registration with an Engine object in order to have
897 the read() method called when a socket is availble for reading."""
897 the read() method called when a socket is availble for reading."""
898
898
899 def __init__(self, zeroconf):
899 def __init__(self, zeroconf):
900 self.zeroconf = zeroconf
900 self.zeroconf = zeroconf
901 self.zeroconf.engine.addReader(self, self.zeroconf.socket)
901 self.zeroconf.engine.addReader(self, self.zeroconf.socket)
@@ -922,7 +922,7 b' class Listener(object):'
922 class Reaper(threading.Thread):
922 class Reaper(threading.Thread):
923 """A Reaper is used by this module to remove cache entries that
923 """A Reaper is used by this module to remove cache entries that
924 have expired."""
924 have expired."""
925
925
926 def __init__(self, zeroconf):
926 def __init__(self, zeroconf):
927 threading.Thread.__init__(self)
927 threading.Thread.__init__(self)
928 self.zeroconf = zeroconf
928 self.zeroconf = zeroconf
@@ -946,7 +946,7 b' class ServiceBrowser(threading.Thread):'
946 The listener object will have its addService() and
946 The listener object will have its addService() and
947 removeService() methods called when this browser
947 removeService() methods called when this browser
948 discovers changes in the services availability."""
948 discovers changes in the services availability."""
949
949
950 def __init__(self, zeroconf, type, listener):
950 def __init__(self, zeroconf, type, listener):
951 """Creates a browser for a specific type"""
951 """Creates a browser for a specific type"""
952 threading.Thread.__init__(self)
952 threading.Thread.__init__(self)
@@ -957,7 +957,7 b' class ServiceBrowser(threading.Thread):'
957 self.nextTime = currentTimeMillis()
957 self.nextTime = currentTimeMillis()
958 self.delay = _BROWSER_TIME
958 self.delay = _BROWSER_TIME
959 self.list = []
959 self.list = []
960
960
961 self.done = 0
961 self.done = 0
962
962
963 self.zeroconf.addListener(self, DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN))
963 self.zeroconf.addListener(self, DNSQuestion(self.type, _TYPE_PTR, _CLASS_IN))
@@ -1017,11 +1017,11 b' class ServiceBrowser(threading.Thread):'
1017
1017
1018 if event is not None:
1018 if event is not None:
1019 event(self.zeroconf)
1019 event(self.zeroconf)
1020
1020
1021
1021
1022 class ServiceInfo(object):
1022 class ServiceInfo(object):
1023 """Service information"""
1023 """Service information"""
1024
1024
1025 def __init__(self, type, name, address=None, port=None, weight=0, priority=0, properties=None, server=None):
1025 def __init__(self, type, name, address=None, port=None, weight=0, priority=0, properties=None, server=None):
1026 """Create a service description.
1026 """Create a service description.
1027
1027
@@ -1087,7 +1087,7 b' class ServiceInfo(object):'
1087 index += 1
1087 index += 1
1088 strs.append(text[index:index+length])
1088 strs.append(text[index:index+length])
1089 index += length
1089 index += length
1090
1090
1091 for s in strs:
1091 for s in strs:
1092 eindex = s.find('=')
1092 eindex = s.find('=')
1093 if eindex == -1:
1093 if eindex == -1:
@@ -1110,7 +1110,7 b' class ServiceInfo(object):'
1110 except:
1110 except:
1111 traceback.print_exc()
1111 traceback.print_exc()
1112 self.properties = None
1112 self.properties = None
1113
1113
1114 def getType(self):
1114 def getType(self):
1115 """Type accessor"""
1115 """Type accessor"""
1116 return self.type
1116 return self.type
@@ -1200,7 +1200,7 b' class ServiceInfo(object):'
1200 result = 1
1200 result = 1
1201 finally:
1201 finally:
1202 zeroconf.removeListener(self)
1202 zeroconf.removeListener(self)
1203
1203
1204 return result
1204 return result
1205
1205
1206 def __eq__(self, other):
1206 def __eq__(self, other):
@@ -1225,7 +1225,7 b' class ServiceInfo(object):'
1225 result += self.text[:17] + "..."
1225 result += self.text[:17] + "..."
1226 result += "]"
1226 result += "]"
1227 return result
1227 return result
1228
1228
1229
1229
1230 class Zeroconf(object):
1230 class Zeroconf(object):
1231 """Implementation of Zeroconf Multicast DNS Service Discovery
1231 """Implementation of Zeroconf Multicast DNS Service Discovery
@@ -1265,7 +1265,7 b' class Zeroconf(object):'
1265 # the SO_REUSE* options have been set, so ignore it
1265 # the SO_REUSE* options have been set, so ignore it
1266 #
1266 #
1267 pass
1267 pass
1268 #self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(self.intf) + socket.inet_aton('0.0.0.0'))
1268 #self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(self.intf) + socket.inet_aton('0.0.0.0'))
1269 self.socket.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'))
1269 self.socket.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'))
1270
1270
1271 self.listeners = []
1271 self.listeners = []
@@ -1276,7 +1276,7 b' class Zeroconf(object):'
1276 self.cache = DNSCache()
1276 self.cache = DNSCache()
1277
1277
1278 self.condition = threading.Condition()
1278 self.condition = threading.Condition()
1279
1279
1280 self.engine = Engine(self)
1280 self.engine = Engine(self)
1281 self.listener = Listener(self)
1281 self.listener = Listener(self)
1282 self.reaper = Reaper(self)
1282 self.reaper = Reaper(self)
@@ -1471,7 +1471,7 b' class Zeroconf(object):'
1471 record = entry
1471 record = entry
1472 else:
1472 else:
1473 self.cache.add(record)
1473 self.cache.add(record)
1474
1474
1475 self.updateRecord(now, record)
1475 self.updateRecord(now, record)
1476
1476
1477 def handleQuery(self, msg, addr, port):
1477 def handleQuery(self, msg, addr, port):
@@ -1545,11 +1545,11 b' class Zeroconf(object):'
1545 self.unregisterAllServices()
1545 self.unregisterAllServices()
1546 self.socket.setsockopt(socket.SOL_IP, socket.IP_DROP_MEMBERSHIP, socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'))
1546 self.socket.setsockopt(socket.SOL_IP, socket.IP_DROP_MEMBERSHIP, socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'))
1547 self.socket.close()
1547 self.socket.close()
1548
1548
1549 # Test a few module features, including service registration, service
1549 # Test a few module features, including service registration, service
1550 # query (for Zoe), and service unregistration.
1550 # query (for Zoe), and service unregistration.
1551
1551
1552 if __name__ == '__main__':
1552 if __name__ == '__main__':
1553 print "Multicast DNS Service Discovery for Python, version", __version__
1553 print "Multicast DNS Service Discovery for Python, version", __version__
1554 r = Zeroconf()
1554 r = Zeroconf()
1555 print "1. Testing registration of a service..."
1555 print "1. Testing registration of a service..."
General Comments 0
You need to be logged in to leave comments. Login now