Opened 13 years ago

Closed 11 years ago

#48 closed defect (fixed)

few issues while adding XMPPHandlers

Reported by: ff Owned by: ralphm
Priority: normal Milestone:
Component: generic Keywords: review


Adding an XMPPHandler after the stream has started and non yet completely initialized may cause several problems:

  • if you add an handler inside the connectionInitialized of a second handler the connectionInitialized of first one is called twice
  • if you are unlucky and your handler is added between the _connected and the _authd event you get an exception since makeConnetion is never called

Attachments (1)

subprotocols.diff (760 bytes) - added by ff 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by ff

comment:1 Changed 13 years ago by ff

I've attached a file with the possible patch. (I've also moved as class attributes the initialization of xmlstream and parent to None, but this ha no implication on the bug, is just for commodity in order not to call the init each time you write a constructor for an handler)

comment:2 Changed 12 years ago by ralphm

  • Keywords review added
  • Status changed from new to assigned

This should just get a review.

comment:3 Changed 11 years ago by ralphm

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2c8dc93fbef4]) Fix race condition and nesting errors when adding a new subprotocol handler.

This fixes two related issues with adding a new subprotocol handler:

  • Adding a handler when the stream is not yet initialized (authenticated) does not cause connectionMade to be called.
  • Adding a handler in connectionMade, connectionInitialized, or connectionLost modifies the lists of handlers iterated over, causing some methods being called too often.

Author: ff, kandaurovoleg, ralphm. Fixes: #48.

Note: See TracTickets for help on using tickets.