Skip to content

Commit

Permalink
Change process detection
Browse files Browse the repository at this point in the history
  • Loading branch information
elg committed Feb 14, 2020
1 parent bc0dcad commit da0ca75
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions passhportd/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,9 @@ def checkandterminatesshsession():
return "No active connection."

for entry in lentries:
try:
parent = psutil.Process(entry.pid)
except Exception as E:
if type(E) == psutil.NoSuchProcess:
endsshsession(entry.pid)
app.logger.warning("Orphan connection with PID:" + \
if not psutil.pid_exists(entry.pid):
endsshsession(entry.pid)
app.logger.warning("Orphan connection with PID:" + \
str(entry.pid) + ". Now closed in the logentry.")

return "Active connections: check done."
Expand Down

0 comments on commit da0ca75

Please sign in to comment.