Skip to content

Commit

Permalink
Update net_connections method and bump version to 0.14.6 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
horta committed Oct 31, 2024
1 parent 54ab905 commit d1e4361
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions h3daemon/h3daemon/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ def is_running(self):
return self._proc.is_running()

def local_listening_ports(self):
connections = self._proc.connections(kind="tcp")
connections = self._proc.net_connections(kind="tcp")
connections = [x for x in connections if x.status == "LISTEN"]
return [x.laddr.port for x in connections if x.laddr.ip == "0.0.0.0"]

def local_established_ports(self):
connections = self._proc.connections(kind="tcp")
connections = self._proc.net_connections(kind="tcp")
connections = [x for x in connections if x.status == "ESTABLISHED"]
return [x.laddr.port for x in connections if x.laddr.ip == "127.0.0.1"]

def remote_established_ports(self):
connections = self._proc.connections(kind="tcp")
connections = self._proc.net_connections(kind="tcp")
connections = [x for x in connections if x.status == "ESTABLISHED"]
return [x.raddr.port for x in connections if x.raddr.ip == "127.0.0.1"]
6 changes: 3 additions & 3 deletions h3daemon/h3daemon/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def has_connected(pid: int):
try:
for x in psutil.Process(pid).connections(kind="tcp"):
for x in psutil.Process(pid).net_connections(kind="tcp"):
if x.status == "ESTABLISHED":
return True
except RuntimeError:
Expand Down Expand Up @@ -52,11 +52,11 @@ def is_running(self):
return self._proc.is_running()

def local_established_ports(self):
connections = self._proc.connections(kind="tcp")
connections = self._proc.net_connections(kind="tcp")
connections = [x for x in connections if x.status == "ESTABLISHED"]
return [x.laddr.port for x in connections if x.laddr.ip == "127.0.0.1"]

def remote_established_ports(self):
connections = self._proc.connections(kind="tcp")
connections = self._proc.net_connections(kind="tcp")
connections = [x for x in connections if x.status == "ESTABLISHED"]
return [x.raddr.port for x in connections if x.raddr.ip == "127.0.0.1"]
8 changes: 4 additions & 4 deletions h3daemon/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[tool.poetry]
name = "h3daemon"
version = "0.14.5"
version = "0.14.6"
description = "HMMER server"
authors = ["Danilo Horta <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
hmmer = "^3.4"
psutil = "^6.0"
python-daemon = "^3.0"
psutil = "^6.1.0"
typer = "^0.12"
hmmer = "^3.4.0.0"
python-daemon = "^3.1.0"
pidlockfile = "^0.3"

[build-system]
Expand Down

0 comments on commit d1e4361

Please sign in to comment.