Skip to content

Commit

Permalink
fix #1125: [BSD] net_connections() raises TypeError.
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Sep 8, 2017
1 parent 147a35a commit 56e82a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ XXXX-XX-XX
**Big fixes**

- 1105_: [FreeBSD] psutil does not compile on FreeBSD 12.
- 1125_: [BSD] net_connections() raises TypeError.

**Compatibility notes**

Expand Down
7 changes: 5 additions & 2 deletions psutil/_psbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,12 @@ def net_connections(kind):
# have a very short lifetime so maybe the kernel
# can't initialize their status?
status = TCP_STATUSES[cext.PSUTIL_CONN_NONE]
if fam in (AF_INET, AF_INET6):
if laddr:
laddr = _common.addr(*laddr)
if raddr:
raddr = _common.addr(*raddr)
fam = sockfam_to_enum(fam)
laddr = _common.addr(*laddr)
raddr = _common.addr(*raddr)
type = socktype_to_enum(type)
nt = _common.sconn(fd, fam, type, laddr, raddr, status, pid)
ret.add(nt)
Expand Down

0 comments on commit 56e82a6

Please sign in to comment.