예제 #1
0
class ConnectListener(Listener):
    """Waits for the **CONNECTED** frame to arrive.
    """
    @defer.inlineCallbacks
    def onConnect(self, connection, frame,
                  connectedTimeout):  # @UnusedVariable
        self._waiting = WaitingDeferred()
        yield self._waiting.wait(
            connectedTimeout,
            StompCancelledError(
                'STOMP broker did not answer on time [timeout=%s]' %
                connectedTimeout))

    def onConnected(self, connection, frame):  # @UnusedVariable
        connection.remove(self)
        self._waiting.callback(None)

    def onConnectionLost(self, connection, reason):
        connection.remove(self)
        if not self._waiting.called:
            self._waiting.errback(reason)

    def onError(self, connection, frame):
        self.onConnectionLost(
            connection,
            StompProtocolError('While trying to connect, received %s' %
                               frame.info()))
예제 #2
0
 def onConnect(self, connection, frame,
               connectedTimeout):  # @UnusedVariable
     self._waiting = WaitingDeferred()
     yield self._waiting.wait(
         connectedTimeout,
         StompCancelledError(
             'STOMP broker did not answer on time [timeout=%s]' %
             connectedTimeout))
예제 #3
0
class ConnectListener(Listener):
    """Waits for the **CONNECTED** frame to arrive.
    """
    @defer.inlineCallbacks
    def onConnect(self, connection, frame, connectedTimeout): # @UnusedVariable
        self._waiting = WaitingDeferred()
        yield self._waiting.wait(connectedTimeout, StompCancelledError('STOMP broker did not answer on time [timeout=%s]' % connectedTimeout))

    def onConnected(self, connection, frame): # @UnusedVariable
        connection.remove(self)
        self._waiting.callback(None)

    def onConnectionLost(self, connection, reason):
        connection.remove(self)
        if not self._waiting.called:
            self._waiting.errback(reason)

    def onError(self, connection, frame):
        self.onConnectionLost(connection, StompProtocolError('While trying to connect, received %s' % frame.info()))
예제 #4
0
 def onConnect(self, connection, frame, connectedTimeout): # @UnusedVariable
     self._waiting = WaitingDeferred()
     yield self._waiting.wait(connectedTimeout, StompCancelledError('STOMP broker did not answer on time [timeout=%s]' % connectedTimeout))