Opened 11 years ago

Last modified 11 years ago

#232 defect closed fixed (fixed)

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

Reported by: exarkun Owned by: spiv
Priority: high Milestone:
Component: Keywords:
Cc: glyph, radix, exarkun, spiv, itamarst Branch:
Author: Launchpad Bug:

Description


Change History (9)

comment:1 Changed 11 years ago by exarkun

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 11 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 11 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 11 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 11 years ago by exarkun

Exception sounds good to me.

comment:6 Changed 11 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 11 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 11 years ago by moshez

/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 11 years ago by moshez

woops really resolving
Note: See TracTickets for help on using tickets.