title: Twisted reactor get current status
body: <p>Sorry for the vague title, but I couldn't figure out something better.</p>
  
  <p>Are there any ways to get the current status of the reactor in twisted?
  By status I mean:</p>
  
  <ul>
  <li>Listeners on ports</li>
  <li>Connected protocols</li>
  <li>Deferreds that are waiting to be fired</li>
  <li>LoopingCalls that are running</li>
  <li>Threads that are "idle"</li>
  <li>and other "active" stuff...</li>
  </ul>
  
  <p>Basically I'm trying to figure out if the reactor is just sitting idly.
  The question itself is broader than what I actually need to do, for the sake of completeness for stackoverflow.</p>
  
  <p>Now, my current situation is as follows:</p>
  
  <p>I'm using someone else's script that listens on many "dynamic" ports that are selected by this person's script, so I can't just use my script to do something like listenTCP, or TCP4ServerEndpoint and check the status of it.
  This is somewhat similar to non-PASV FTP where each listening port is discarded after each use.
  The other problem is that my own little program is also running in the same process, which I use it as an argument to start his program. It's basically an interface to his program.
  When all his things are done AND my things are done as well, I want to shutdown the reactor.
  Thus I'm trying to figure out when I can stop the reactor.
  My exact condition to shutdown is as follow:</p>
  
  <ul>
  <li>Only listening on 1 port, and no other.</li>
  <li>No deffereds nor loopingCalls that are gonna fire.</li>
  </ul>
  
  <p>I searched but only found things like "if reactor.running" or <a href="https://stackoverflow.com/questions/6526923/stop-twisted-reactor-on-a-condition">Stop twisted reactor on a condition</a>, which needs to keep track by using flags.
  I would rather not touch his code. If it's something that could contribute to twisted, I'd much rather do that.
  But if there is already an alternative, I'd rather not re-invent the wheel.</p>
  
  <p>Does his script need to be changed so it notifies my script of these conditions?</p>