예제 #1
0
    def _cbSubsystem(self, result):
        self.client = amp.AMP()
        self.client.makeConnection(self)
        self.dataReceived = self.client.dataReceived

        self.client.callRemote(server.OfferShell).addCallback(
            self._cbDone).addErrback(self._ebFailed)
예제 #2
0
 def test_sillyEmptyThing(self):
     """
     Test that empty boxes raise an error; they aren't supposed to be sent
     on purpose.
     """
     a = amp.AMP()
     return self.assertRaises(amp.NoEmptyBoxes, a.ampBoxReceived, amp.Box())
예제 #3
0
 def initiate(self, gameMode):
     self.gameMode = gameMode
     point = TCP4ClientEndpoint(reactor, "localhost", self.port)
     self.deferred = connectProtocol(point, amp.AMP())
     self.deferred.addCallback(self.handshakeMaster)
     self.deferred.addCallback(self.recieveHubsPort)
     self.deferred.addCallback(self.applyNewPort)
     reactor.callLater(3, self.switchConnectionToHub)
예제 #4
0
파일: wire.py 프로젝트: edsuom/AsynQueue
 def __init__(self, description, wwu):
     if isinstance(wwu, str):
         klass = reflect.namedObject(wwu)
         wwu = klass(self)
     WireWorkerUniverse.check(wwu)
     self.factory = Factory()
     self.factory.protocol = lambda: amp.AMP(locator=wwu)
     endpoint = endpoints.serverFromString(reactor, description)
     self.service = StreamServerEndpointService(endpoint, self.factory)
예제 #5
0
 def makeService(self, options):
     application = pyramid_dynamic.application
     pool = threadpool.ThreadPool(minthreads=1, maxthreads=100)
     reactor.callWhenRunning(pool.start)
     reactor.addSystemEventTrigger('after', 'shutdown', pool.stop)
     root = wsgi.WSGIResource(reactor, pool, application)
     site = server.Site(root)
     control = protocol.Factory()
     control.protocol = lambda: amp.AMP(locator=AppConfiguration())
     ret = service.MultiService()
     strports.service('tcp:8000', site).setServiceParent(ret)
     strports.service('tcp:8001', control).setServiceParent(ret)
     return ret
예제 #6
0
 def buildProtocol(self, addr):
     protocol = amp.AMP()
     self.forwarder.protocols.append(protocol)
     return protocol
예제 #7
0
 def buildProtocol(self, addr):
     disp = amp.BoxDispatcher(self.responder)
     a = amp.AMP(boxReceiver=disp, locator=self.responder)
     a.factory = self
     return a
예제 #8
0
 def switchConnectionToHub(self):
     point = TCP4ClientEndpoint(reactor, "localhost", self.port)
     self.deferred = connectProtocol(point, amp.AMP())
     self.deferred.addCallback(self.handshakeHub)
     self.deferred.addCallback(self.receiveID)
     self.deferred.addCallback(self.applyID)