'Update the ports list.'

@GlancesPlugin._log_result_decorator
def update(self):

    if (self.input_method == 'local'):
        if (self._thread is None):
            thread_is_running = False
        else:
            thread_is_running = self._thread.isAlive()
        if (self.timer_ports.finished() and (not thread_is_running)):
            self._thread = ThreadScanner(self.stats)
            self._thread.start()
            if (len(self.stats) > 0):
                self.timer_ports = Timer(self.stats[0]['refresh'])
            else:
                self.timer_ports = Timer(0)
    else:
        pass
    return self.stats
