equal
deleted
inserted
replaced
28 from Pyro.errors import PyroError |
28 from Pyro.errors import PyroError |
29 import traceback |
29 import traceback |
30 from time import sleep |
30 from time import sleep |
31 import copy |
31 import copy |
32 import socket |
32 import socket |
|
33 import os.path |
|
34 |
33 service_type = '_PYRO._tcp.local.' |
35 service_type = '_PYRO._tcp.local.' |
34 import os.path |
|
35 # this module attribute contains a list of DNS-SD (Zeroconf) service types |
36 # this module attribute contains a list of DNS-SD (Zeroconf) service types |
36 # supported by this connector confnode. |
37 # supported by this connector confnode. |
37 # |
38 # |
38 # for connectors that do not support DNS-SD, this attribute can be omitted |
39 # for connectors that do not support DNS-SD, this attribute can be omitted |
39 # or set to an empty list. |
40 # or set to an empty list. |
|
41 |
40 |
42 |
41 def PYRO_connector_factory(uri, confnodesroot): |
43 def PYRO_connector_factory(uri, confnodesroot): |
42 """ |
44 """ |
43 This returns the connector to Pyro style PLCobject |
45 This returns the connector to Pyro style PLCobject |
44 """ |
46 """ |
60 else: |
62 else: |
61 confnodesroot.logger.write(_("PYRO using certificates in '%s' \n") |
63 confnodesroot.logger.write(_("PYRO using certificates in '%s' \n") |
62 % (Pyro.config.PYROSSL_CERTDIR)) |
64 % (Pyro.config.PYROSSL_CERTDIR)) |
63 Pyro.config.PYROSSL_CERT = "client.crt" |
65 Pyro.config.PYROSSL_CERT = "client.crt" |
64 Pyro.config.PYROSSL_KEY = "client.key" |
66 Pyro.config.PYROSSL_KEY = "client.key" |
|
67 |
65 # Ugly Monkey Patching |
68 # Ugly Monkey Patching |
66 def _gettimeout(self): |
69 def _gettimeout(self): |
67 return self.timeout |
70 return self.timeout |
68 |
71 |
69 def _settimeout(self, timeout): |
72 def _settimeout(self, timeout): |
85 if i is None: |
88 if i is None: |
86 raise Exception("'%s' not found" % location) |
89 raise Exception("'%s' not found" % location) |
87 ip = str(socket.inet_ntoa(i.getAddress())) |
90 ip = str(socket.inet_ntoa(i.getAddress())) |
88 port = str(i.getPort()) |
91 port = str(i.getPort()) |
89 newlocation = ip + ':' + port |
92 newlocation = ip + ':' + port |
90 confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1 = location, a2 = newlocation)) |
93 confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1=location, a2=newlocation)) |
91 location = newlocation |
94 location = newlocation |
92 r.close() |
95 r.close() |
93 except Exception, msg: |
96 except Exception, msg: |
94 confnodesroot.logger.write_error(_("MDNS resolution failure for '%s'\n") % location) |
97 confnodesroot.logger.write_error(_("MDNS resolution failure for '%s'\n") % location) |
95 confnodesroot.logger.write_error(traceback.format_exc()) |
98 confnodesroot.logger.write_error(traceback.format_exc()) |