Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/icgc-dcc/jtracker
Browse files Browse the repository at this point in the history
  • Loading branch information
junjun-zhang committed May 14, 2017
2 parents 97e0b99 + 60f2f42 commit f76fdd4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions jtracker/jtracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ def _init_host_id(self):

def _init_host_ip(self):
try:
self._host_ip = [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0]
self._host_ip = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1][0]
except:
self._host_ip = '127.0.0.1'
try:
self._host_ip = [(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]
except:
self._host_ip = '127.0.0.1'

@staticmethod
def _find_file(name, path):
Expand Down

0 comments on commit f76fdd4

Please sign in to comment.