|
|
@ -367,6 +367,7 @@ class LinuxTCPConnectionInfo(TCPConnectionInfo):
|
|
|
|
for family in self.source_file.keys():
|
|
|
|
for family in self.source_file.keys():
|
|
|
|
if not os.path.isfile(self.source_file[family]):
|
|
|
|
if not os.path.isfile(self.source_file[family]):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
try:
|
|
|
|
f = open(self.source_file[family])
|
|
|
|
f = open(self.source_file[family])
|
|
|
|
for tcp_connection in f.readlines():
|
|
|
|
for tcp_connection in f.readlines():
|
|
|
|
tcp_connection = tcp_connection.strip().split()
|
|
|
|
tcp_connection = tcp_connection.strip().split()
|
|
|
@ -388,7 +389,11 @@ class LinuxTCPConnectionInfo(TCPConnectionInfo):
|
|
|
|
(family, self.ipv4_mapped_ipv6_address['match_all']) in self.ips,
|
|
|
|
(family, self.ipv4_mapped_ipv6_address['match_all']) in self.ips,
|
|
|
|
)):
|
|
|
|
)):
|
|
|
|
active_connections += 1
|
|
|
|
active_connections += 1
|
|
|
|
|
|
|
|
except IOError as e:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
finally:
|
|
|
|
f.close()
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
return active_connections
|
|
|
|
return active_connections
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -649,11 +654,9 @@ def main():
|
|
|
|
end = start + datetime.timedelta(seconds=timeout)
|
|
|
|
end = start + datetime.timedelta(seconds=timeout)
|
|
|
|
tcpconns = TCPConnectionInfo(module)
|
|
|
|
tcpconns = TCPConnectionInfo(module)
|
|
|
|
while datetime.datetime.utcnow() < end:
|
|
|
|
while datetime.datetime.utcnow() < end:
|
|
|
|
try:
|
|
|
|
|
|
|
|
if tcpconns.get_active_connections_count() == 0:
|
|
|
|
if tcpconns.get_active_connections_count() == 0:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
except IOError:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Conditions not yet met, wait and try again
|
|
|
|
# Conditions not yet met, wait and try again
|
|
|
|
time.sleep(module.params['sleep'])
|
|
|
|
time.sleep(module.params['sleep'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|