Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2828 defect closed invalid (invalid)

xmlstream.IQ shouldn't create timeout deferreds for every IQ

Reported by: jack Owned by: ralphm
Priority: normal Milestone:
Component: words Keywords:
Cc: jack, ralphm Branch:
Author:

Description

Only IQ type='get' and type='set' should get these. There are no responses to type='error' and type='result', but currently the code makes timeouts for these as well.

Attachments (2)

test_iq_timeout.py (658 bytes) - added by jack 11 years ago.
test case for the bug
timeout.patch (2.1 KB) - added by jack 11 years ago.
patch for the bug

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by jack

Attachment: test_iq_timeout.py added

test case for the bug

Changed 11 years ago by jack

Attachment: timeout.patch added

patch for the bug

comment:1 Changed 11 years ago by ralphm

Cc: jack ralphm added
Resolution: invalid
Status: newclosed

Jack, thanks for your ticket. As you can see in the docstring of __init__, the stanzaType parameter is to be either get or set. The IQ class was not designed for the use case you mention.

Why would you create a result or error iq out of the blue, using this class? Instead, you'd generally always do that in response to an iq stanza you received. In that case, you can use the twisted.words.protocols.jabber.xmlstream.toResponse for a result IQ or create a stanzaError and call its toResponse` method instead.

comment:2 Changed 11 years ago by Jean-Paul Calderone

Perhaps "set" and "get" should be symbolic constants instead of string literals, and IQ.init could raise an exception if it is given an invalid value?

comment:3 Changed 11 years ago by ralphm

I can see the value in raising an exception, but why the symbolic constants? The 4 values mentioned above are the only ones possible and this is not going to change.

comment:4 Changed 11 years ago by jack

+1 on the exceptions. I'll check our code and see what the root cause of our issue is. I probably should have read the doctstring closer.

Note: See TracTickets for help on using tickets.