Lines 245-263
Link Here
|
245 |
tempconns[conn] = 0 |
245 |
tempconns[conn] = 0 |
246 |
|
246 |
|
247 |
#Call the netstat utility and split the output into separate lines |
247 |
#Call the netstat utility and split the output into separate lines |
248 |
fd_poll = select.poll() |
248 |
self.popenChild = popen2.Popen3("netstat -t -a -n") |
249 |
self.popenChild = popen2.Popen3("netstat -t -a") |
249 |
lines = self.popenChild.fromchild.readlines() |
250 |
fd_poll.register(self.popenChild.fromchild) |
|
|
251 |
|
250 |
|
252 |
poll_events = fd_poll.poll() |
251 |
try: |
253 |
|
252 |
self.popenChild.wait() |
254 |
if (len(poll_events) == 0): # Timeout |
253 |
except OSError, e: |
255 |
continue |
254 |
if e.errno == 10: # No child process |
256 |
|
255 |
continue |
257 |
for (fd, events) in poll_events: |
|
|
258 |
lines = self.popenChild.fromchild.readlines() |
259 |
|
260 |
self.popenChild.wait() |
261 |
|
256 |
|
262 |
#Iterate through the netstat output looking for the 'tcp' keyword in the tcp_at |
257 |
#Iterate through the netstat output looking for the 'tcp' keyword in the tcp_at |
263 |
# position and the state information in the tcp_state_at position. Count each |
258 |
# position and the state information in the tcp_state_at position. Count each |
Lines 300-306
Link Here
|
300 |
_glock.release() |
295 |
_glock.release() |
301 |
|
296 |
|
302 |
#Wait for the refresh_rate period before collecting the netstat data again. |
297 |
#Wait for the refresh_rate period before collecting the netstat data again. |
303 |
time.sleep(_refresh_rate) |
298 |
if not self.shuttingdown: |
|
|
299 |
time.sleep(_refresh_rate) |
304 |
|
300 |
|
305 |
#Set the current state of the thread after a shutdown has been indicated. |
301 |
#Set the current state of the thread after a shutdown has been indicated. |
306 |
self.running = False |
302 |
self.running = False |