util/Zeroconf.py
changeset 1780 c52d1460cea8
parent 1762 fcc406143e5b
child 1782 5b6ad7a7fd9d
--- a/util/Zeroconf.py	Sat Aug 19 17:17:54 2017 +0300
+++ b/util/Zeroconf.py	Sat Aug 19 18:12:20 2017 +0300
@@ -241,14 +241,14 @@
         """Class accessor"""
         try:
             return _CLASSES[clazz]
-        except:
+        except Exception:
             return "?(%s)" % (clazz)
 
     def getType(self, type):
         """Type accessor"""
         try:
             return _TYPES[type]
-        except:
+        except Exception:
             return "?(%s)" % (type)
 
     def toString(self, hdr, other):
@@ -366,7 +366,7 @@
         """String representation"""
         try:
             return socket.inet_ntoa(self.address)
-        except:
+        except Exception:
             return self.address
 
 
@@ -799,7 +799,7 @@
         """Adds an entry"""
         try:
             list = self.cache[entry.key]
-        except:
+        except Exception:
             list = self.cache[entry.key] = []
         list.append(entry)
 
@@ -808,7 +808,7 @@
         try:
             list = self.cache[entry.key]
             list.remove(entry)
-        except:
+        except Exception:
             pass
 
     def get(self, entry):
@@ -817,7 +817,7 @@
         try:
             list = self.cache[entry.key]
             return list[list.index(entry)]
-        except:
+        except Exception:
             return None
 
     def getByDetails(self, name, type, clazz):
@@ -830,7 +830,7 @@
         """Returns a list of entries whose key matches the name."""
         try:
             return self.cache[name]
-        except:
+        except Exception:
             return []
 
     def entries(self):
@@ -838,7 +838,7 @@
         def add(x, y): return x+y
         try:
             return reduce(add, self.cache.values())
-        except:
+        except Exception:
             return []
 
 
@@ -878,10 +878,10 @@
                     for socket in rr:
                         try:
                             self.readers[socket].handle_read()
-                        except:
+                        except Exception:
                             # Ignore errors that occur on shutdown
                             pass
-                except:
+                except Exception:
                     pass
 
     def getReaders(self):
@@ -1000,7 +1000,7 @@
                     del(self.services[record.alias.lower()])
                     self.list.append(callback)
                     return
-            except:
+            except Exception:
                 if not expired:
                     def callback(x):
                         return self.listener.addService(x, self.type, record.alias)
@@ -1130,7 +1130,7 @@
                     result[key] = value
 
             self.properties = result
-        except:
+        except Exception:
             traceback.print_exc()
             self.properties = None
 
@@ -1263,7 +1263,7 @@
         try:
             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
-        except:
+        except Exception:
             # SO_REUSEADDR should be equivalent to SO_REUSEPORT for
             # multicast UDP sockets (p 731, "TCP/IP Illustrated,
             # Volume 2"), but some BSD-derived systems require
@@ -1278,7 +1278,7 @@
         self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP, 1)
         try:
             self.socket.bind(self.group)
-        except:
+        except Exception:
             # Some versions of linux raise an exception even though
             # the SO_REUSE* options have been set, so ignore it
             #
@@ -1375,7 +1375,7 @@
         """Unregister a service."""
         try:
             del(self.services[info.name.lower()])
-        except:
+        except Exception:
             pass
         now = currentTimeMillis()
         nextTime = now
@@ -1460,7 +1460,7 @@
         try:
             self.listeners.remove(listener)
             self.notifyAll()
-        except:
+        except Exception:
             pass
 
     def updateRecord(self, now, rec):
@@ -1529,7 +1529,7 @@
                         out.addAnswer(msg, DNSText(question.name, _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE, _DNS_TTL, service.text))
                     if question.type == _TYPE_SRV:
                         out.addAdditionalAnswer(DNSAddress(service.server, _TYPE_A, _CLASS_IN | _CLASS_UNIQUE, _DNS_TTL, service.address))
-                except:
+                except Exception:
                     traceback.print_exc()
 
         if out is not None and out.answers:
@@ -1542,7 +1542,7 @@
         #temp = DNSIncoming(out.packet())
         try:
             bytes_sent = self.socket.sendto(out.packet(), 0, (addr, port))
-        except:
+        except Exception:
             # Ignore this, it may be a temporary loss of network connection
             pass