connectors/PYRO/__init__.py
branch1.1 Korean release
changeset 1280 72a826dfcfbb
parent 1116 300f98a8d4c6
child 1434 6e0cd0ceabb7
--- a/connectors/PYRO/__init__.py	Wed Mar 13 12:34:55 2013 +0900
+++ b/connectors/PYRO/__init__.py	Wed Jul 31 10:45:07 2013 +0900
@@ -45,6 +45,7 @@
             from util.Zeroconf import Zeroconf
             r = Zeroconf()
             i=r.getServiceInfo(service_type, location)
+            if i is None : raise Exception, "'%s' not found"%location
             ip = str(socket.inet_ntoa(i.getAddress()))
             port = str(i.getPort())
             newlocation = ip+':'+port
@@ -72,18 +73,18 @@
         def catcher_func(*args,**kwargs):
             try:
                 return func(*args,**kwargs)
-            except Pyro.errors.ProtocolError, e:
-                pass
             except Pyro.errors.ConnectionClosedError, e:
                 confnodesroot.logger.write_error("Connection lost!\n")
-                confnodesroot._connector = None
+                confnodesroot._SetConnector(None)
+            except Pyro.errors.ProtocolError, e:
+                confnodesroot.logger.write_error("Pyro exception: "+str(e)+"\n")
             except Exception,e:
                 #confnodesroot.logger.write_error(traceback.format_exc())
                 errmess = ''.join(Pyro.util.getPyroTraceback(e))
                 confnodesroot.logger.write_error(errmess+"\n")
                 print errmess
-                confnodesroot._connector = None
-                return default
+                confnodesroot._SetConnector(None)
+            return default
         return catcher_func
 
     # Check connection is effective.