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()))
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))
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()))
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))