Example #1
0
 def _createLoopbackBroker(self, tubref):
     t1,t2 = broker.LoopbackTransport(), broker.LoopbackTransport()
     t1.setPeer(t2); t2.setPeer(t1)
     n = negotiate.Negotiation()
     params = n.loopbackDecision()
     b1,b2 = (self.brokerClass(tubref, params),
              self.brokerClass(tubref, params))
     # we treat b1 as "our" broker, and b2 as "theirs", and we pretend
     # that b2 has just connected to us. We keep track of b1, and b2 keeps
     # track of us.
     b1.setTub(self)
     b2.setTub(self)
     t1.protocol = b1; t2.protocol = b2
     b1.makeConnection(t1); b2.makeConnection(t2)
     self.connectionAttached(b1)
     self.connectionAttached(b2)
     self.brokerAttached(tubref, b1, False)
     return b1
Example #2
0
 def _createLoopbackBroker(self, tubref):
     t1, t2 = broker.LoopbackTransport(), broker.LoopbackTransport()
     t1.setPeer(t2)
     t2.setPeer(t1)
     n = negotiate.Negotiation()
     params = n.loopbackDecision()
     ci = info.ConnectionInfo()
     b1 = self.brokerClass(tubref, params, connectionInfo=ci)
     b2 = self.brokerClass(tubref, params)
     # we treat b1 as "our" broker, and b2 as "theirs", and we pretend
     # that b2 has just connected to us. We keep track of b1, and b2 keeps
     # track of us.
     b1.setTub(self)
     b2.setTub(self)
     t1.protocol = b1
     t2.protocol = b2
     b1.makeConnection(t1)
     b2.makeConnection(t2)
     ci._set_connected(True)
     ci._set_winning_hint("loopback")
     ci._set_connection_status("loopback", "connected")
     ci._set_established_at(b1.creation_timestamp)
     self.brokerAttached(tubref, b1, False)
     return b1