Opened 14 years ago

Last modified 17 months ago

#232 defect closed fixed (fixed)

Calling registerProducer() multiple times without calling unregisterProducer() is confusing

Reported by: Jean-Paul Calderone Owned by: spiv
Priority: high Milestone:
Component: Keywords:
Cc: Glyph, radix, Jean-Paul Calderone, spiv, itamarst Branch:
Author:

Description


Change History (10)

comment:1 Changed 14 years ago by Jean-Paul Calderone

registerProducer() will happily replace an existing one with
the new producer, leading to behavior where an old producer
is never resumed again.  This seems like it would only ever
be a bug.  Would an assert or a log warning make sense in
registerProducer() to ensure no one ever does this without
realizing it?

comment:2 Changed 14 years ago by itamarst

alternatively, the old producer should get stopProducing
called. But we do need a specific behaviour to be documented
and implemented.

comment:3 Changed 14 years ago by spiv

I'd lean towards "explict is better than implicit", i.e.
don't magically call stopProducing.  I think a
warning.warn("registerProducer called, but a producer is
already registered") would be my preference, perhaps to
become an exception in a later release.

comment:4 Changed 14 years ago by itamarst

seeing that doing this is a bug (since the old producer will
continue to produce if it's streaming) I suggest it be an
exception from the start. Anyone disagree?

comment:5 Changed 14 years ago by Jean-Paul Calderone

Exception sounds good to me.

comment:6 Changed 14 years ago by spiv

Ok, that makes sense.  I'll look at making it raise an
exception, then (seeing as someone kindly, uh, "volunteered"
me :)

comment:7 Changed 14 years ago by Glyph

On Tuesday, August 26, 2003, at 12:50 AM, Andrew Bennetts wrote:

> perhaps to become an exception in a later release.

I'd say make it an exception now.  AFAICT this behavior is undefined as 
it is.

comment:8 Changed 14 years ago by Moshe Zadka

/cvs/Twisted/twisted/internet/abstract.py,v  <--  abstract.py
new revision: 1.40; previous revision: 1.39
/cvs/Twisted/twisted/test/test_internet.py,v  <--  test_internet.py
new revision: 1.35; previous revision: 1.34

Fixed, resolving.

comment:9 Changed 14 years ago by Moshe Zadka

woops really resolving

comment:10 Changed 17 months ago by GitHub <noreply@…>

In a1171ec:

Merge pull request #232 from twisted/py3-example-xmpp-8509

Port Jabber/XMPP examples to Python 3.

Author: ralphm
Reviewer: adiroiban
Fixes: #8509

Note: See TracTickets for help on using tickets.