Exemple #1
0
 def __init__(self, parent, clid, url, interfaceName):
     self.broker = parent
     self.clid = clid
     # TODO: the remote end sends us a global URL, when really it should
     # probably send us a per-Tub name, which can can then concatenate to
     # their TubID if/when we pass it on to others. By accepting a full
     # URL, we give them the ability to sort-of spoof others. For now, we
     # check that their URL uses the same tubid as our broker is
     # expecting, but the Right Way is to just not have them send the base
     # part in the first place. I haven't yet made this change because I'm
     # not yet positive it would work.. how exactly does the base url get
     # sent, anyway? What about Tubs visible through multiple names?
     self.url = url
     if url is not None:
         # unit tests frequently set url=None
         assert self.broker.remote_tubref
         expected_tubid = self.broker.remote_tubref.getTubID()
         url_tubid = SturdyRef(url).getTubRef().getTubID()
         if expected_tubid != url_tubid:
             raise BananaError("inbound reference claims bad tubid, %s vs %s"
                               % (expected_tubid, url_tubid))
     self.interfaceName  = interfaceName
     self.interface      = getRemoteInterfaceByName(interfaceName)
     self.received_count = 0
     self.ref = None
 def __init__(self, parent, clid, url, interfaceName):
     self.broker = parent
     self.clid = clid
     # TODO: the remote end sends us a global URL, when really it should
     # probably send us a per-Tub name, which can can then concatenate to
     # their TubID if/when we pass it on to others. By accepting a full
     # URL, we give them the ability to sort-of spoof others. For now, we
     # check that their URL uses the same tubid as our broker is
     # expecting, but the Right Way is to just not have them send the base
     # part in the first place. I haven't yet made this change because I'm
     # not yet positive it would work.. how exactly does the base url get
     # sent, anyway? What about Tubs visible through multiple names?
     self.url = url
     if url is not None and self.broker.remote_tubref:
         # unit tests frequently set url=None, and UnauthenticatedTubs
         # don't have a remote_tubref
         expected_tubid = self.broker.remote_tubref.getTubID()
         url_tubid = SturdyRef(url).getTubRef().getTubID()
         if expected_tubid != url_tubid:
             raise BananaError("inbound reference claims bad tubid, %s vs %s"
                               % (expected_tubid, url_tubid))
     self.interfaceName = interfaceName
     self.interface = getRemoteInterfaceByName(interfaceName)
     self.received_count = 0
     self.ref = None