-def check_disconnect_client ():
- vprintf ("Shutting down client 2")
- try:
- server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_no_nat_client_2.conf'])
- server.communicate ()
- except OSError:
- print "Can not stop client 2, exiting..."
- exit (1)
-
- client_transport_disconnected = False
- client_topology_disconnected = False
- client_core_disconnected = False
- client_core_session_map = False
- client_fs_disconnected = False
-
- disconnected = False
- count = 1
- while ((disconnected == False) and (count <= timeout)):
- if ((False == client_transport_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'transport', '# peers connected',0))):
- client_transport_disconnected = True
- vprintf ('Client transport services is disconnected')
-
- if ((False == client_core_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# neighbour entries allocated',0))):
- client_core_disconnected = True
- vprintf ('Client core services is disconnected')
-
- if ((False == client_core_session_map) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'core', '# entries in session map',0))):
- client_core_session_map = True
- vprintf ('Client core notifies about disconnected')
-
- if ((False == client_topology_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'topology', '# peers connected',0))):
- client_topology_disconnected = True
- vprintf ('Client topology services is disconnected')
-
- if ((False == client_fs_disconnected) and (True == check_statistics ('./confs/c_no_nat_client.conf', 'fs', '# peers connected',0))):
- client_fs_disconnected = True
- vprintf ('Client fs services is disconnected')
-
- # Check if conditions fulfilled
- if ((True == client_transport_disconnected) and
- (True == client_topology_disconnected) and
- (True == client_core_disconnected) and
- (True == client_core_session_map) and
- (True == client_fs_disconnected)):
- disconnected = True
- break
- print '.'
- time.sleep(1)
- count += 1
- if (disconnected == False):
- print ''
- if (client_transport_disconnected == False):
- print ('Client transport was NOT disconnected')
- if (client_topology_disconnected == False):
- print ('Client topology was NOT disconnected')
- if (client_core_disconnected == False):
- print ('Client core was NOT disconnected')
- if (server_core_session_map == False):
- print ('Server core sessions did NOT increase')
- return False
- else:
- return True
-
-def check_disconnect_server ():
- vprintf ("Shutting down bootstrap server")
- try:
- server = subprocess.Popen ([gnunetarm, '-eq', '-c', './confs/c_bootstrap_server.conf'])
- server.communicate ()
- except OSError:
- print "Can not stop bootstrap server, exiting..."
- exit (1)
-
- client_transport_disconnected = False
- client_topology_disconnected = False
- client_core_disconnected = False
- client_core_session_map = False
- client_fs_disconnected = False