[Twisted-Python] can the reactor be told to stop processing events and to just queue them?
Hello everyone, is there a way to tell the reactor to just queue the events and not to process them for a specific protocol? I have two protocols running on my reactor, one that monitors the network and one for a usb device, I'd like to pause the event processing for the network side when certain msgs arrive on the usb protocol and then unpause it later on. I know I can create a queue and add the network msgs and process them later but I find it redundant to do so when twisted already has an event queue. Thank you, Gabriel
On Thu, 2010-05-27 at 14:08 +0200, Gabriel Rossetti wrote:
is there a way to tell the reactor to just queue the events and not to process them for a specific protocol?
No, Twisted doesn't have an event queue (but see below).
I have two protocols running on my reactor, one that monitors the network and one for a usb device, I'd like to pause the event processing for the network side when certain msgs arrive on the usb protocol and then unpause it later on. I know I can create a queue and add the network msgs and process them later but I find it redundant to do so when twisted already has an event queue.
How about calling transport.pauseProducing() and then later transport.resumeProducing() on the TCP connections?
Itamar Turner-Trauring wrote:
On Thu, 2010-05-27 at 14:08 +0200, Gabriel Rossetti wrote:
is there a way to tell the reactor to just queue the events and not to process them for a specific protocol?
No, Twisted doesn't have an event queue (but see below).
ok
I have two protocols running on my reactor, one that monitors the network and one for a usb device, I'd like to pause the event processing for the network side when certain msgs arrive on the usb protocol and then unpause it later on. I know I can create a queue and add the network msgs and process them later but I find it redundant to do so when twisted already has an event queue.
How about calling transport.pauseProducing() and then later transport.resumeProducing() on the TCP connections?
Ok, thanks, I'll try that.
Gabriel Rossetti wrote:
Itamar Turner-Trauring wrote:
On Thu, 2010-05-27 at 14:08 +0200, Gabriel Rossetti wrote:
is there a way to tell the reactor to just queue the events and not to process them for a specific protocol?
No, Twisted doesn't have an event queue (but see below).
ok
I have two protocols running on my reactor, one that monitors the network and one for a usb device, I'd like to pause the event processing for the network side when certain msgs arrive on the usb protocol and then unpause it later on. I know I can create a queue and add the network msgs and process them later but I find it redundant to do so when twisted already has an event queue.
How about calling transport.pauseProducing() and then later transport.resumeProducing() on the TCP connections?
Ok, thanks, I'll try that.
Just wanted to confirm that it works as you said, thank you.
participants (2)
-
Gabriel Rossetti
-
Itamar Turner-Trauring