Skip to content

Commit

Permalink
_base_handlers in client should remain const
Browse files Browse the repository at this point in the history
- the setup_stanza_handlers will be called twice, in client.connect and
  client.AuthenticatedEvent respectively. If we modify the
  _base_handlers in connect, our own handler is appened to the
  _base_handlers. Then in subsequent AuthenticatedEvent handler, our own
  handler will be appended again. Result in our own handler being
  registered twice.
  • Loading branch information
rxwen committed Aug 24, 2016
1 parent 3da5c9e commit e81020b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyxmpp2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def connect(self):
service = self.settings["c2s_service"]

transport.connect(addr, self.settings["c2s_port"], service)
handlers = self._base_handlers
handlers = self._base_handlers[:]
handlers += self.handlers + [self]
self.clear_response_handlers()
self.setup_stanza_handlers(handlers, "pre-auth")
Expand Down Expand Up @@ -224,7 +224,7 @@ def _stream_authenticated(self, event):
return
self.me = event.stream.me
self.peer = event.stream.peer
handlers = self._base_handlers
handlers = self._base_handlers[:]
handlers += self.handlers + [self]
self.setup_stanza_handlers(handlers, "post-auth")

Expand Down

0 comments on commit e81020b

Please sign in to comment.