If nc finished during timeout True return, False otherwise
Change-Id: Iae6ae93a11efe095c9e972c207ca526115046e49
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
self.__nc_t.setDaemon(True)
self.__nc_t.start()
- def stop(self):
+ def stop(self, timeout):
self.__nc_t.join(1)
- for i in range(30):
+ for i in range(timeout):
if self.__nc_t.isAlive():
- logging.warning('nc is still running # %ds', i)
+ logging.debug('nc is still running # %ds', i)
time.sleep(1)
else:
logging.info('nc closed')
- break
+ return True
+
+ return False
return self.__commands.keep_alive()
- def stop(self):
+ def stop(self, timeout=30):
'''
Stop profiling
+ :param timeout: timeout for handling stop message
+ :type timeout: seconds (default 30)
+
+ :return: True if SWAP has been stopped, False otherwise
+ :rtype: bool
'''
logging.debug('stop() called')
self.__commands.swap_inst_remove()
self.__commands.stop()
self.__disconnect()
- self.__trace.stop()
+
+ ret = self.__trace.stop(timeout)
+ if ret is False:
+ logging.warning('SWAP is still running')
+
+ return ret