Sorry for the vague name, but I could not understand something better.
Is there a way to get the current state of the reactor in a twisted state? By status I mean:
- Port listeners
- Connected Protocols
- Deferrals awaiting dismissal.
- LoopingCalls that work
- Topics that are “idle”
- and other "active" things ...
Basically, I'm trying to figure out if the reactor is just sitting. The question itself is wider than what I really have to do for the sake of completeness for stackoverflow.
Now my current situation is as follows:
I am using someone else's script that listens on many of the “dynamic” ports selected by this person script, so I cannot just use my script to execute something like listenTCP or TCP4ServerEndpoint and check its status. This is somewhat similar to FTP, other than PASV, where each listening port is dropped after each use. Another problem is that my small program also works in the same process that I use as an argument to run its program. This is basically an interface to his program. When all his affairs are completed and my affairs are completed, I want to turn off the reactor. Thus, I am trying to figure out when I can stop the reactor. My exact stop condition:
- Only listening on one port and the other not.
- No defaults and cycles that will trigger.
I searched, but found things like "if reactor.running" or stopping a twisted reactor under conditions that needed to be tracked using flags. I would not touch his code. If this is something that can affect the perversion, I would rather do it. But if there is already an alternative, I would prefer not to reinvent the wheel.
Does it need to change its script so that it notifies my script about these conditions?
source share