Skip to content

Commit

Permalink
Attempt to fix exception with ipv6 addresses (issue #1).
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecube committed Mar 29, 2013
1 parent a5dbe84 commit 43a70dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions inhibit_shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ def check_services():
if len(items) < 4:
continue

local_addr, local_port = items[3].split(':')
remote_addr, remote_port = items[4].split(':')
local_addr, local_port = items[3].rsplit(':', maxsplit=1)
remote_addr, remote_port = items[4].rsplit(':', maxsplit=1)

if local_addr[0] == '[' and local_addr[-1] == ']':
local_addr = local_addr[1:-1]

if remote_addr[0] == '[' and remote_addr[-1] == ']':
remote_addr = remote_addr[1:-1]

local_port = int(local_port)

Expand Down

0 comments on commit 43a70dc

Please sign in to comment.