This commit is contained in:
emdee 2022-10-26 09:01:50 +00:00
parent 5f1b7d8d93
commit 0819fd4088
8 changed files with 31 additions and 14 deletions

View file

@ -886,13 +886,25 @@ class App:
else: else:
LOG.debug("Have default route for network " +self._oArgs.network) LOG.debug("Have default route for network " +self._oArgs.network)
LOG.debug(f"test_net {self._oArgs.network} iMax= {iMax}") lUdpElts = self._settings['current_nodes_udp']
if self._oArgs.proxy_type <= 0 and not lUdpElts:
title = 'test_net Error'
text = 'Error: ' + str('No UDP nodes')
util_ui.message_box(text, title)
return
lTcpElts = self._settings['current_nodes_tcp']
if self._oArgs.proxy_type > 0 and not lTcpElts:
title = 'test_net Error'
text = 'Error: ' + str('No TCP nodes')
util_ui.message_box(text, title)
return
LOG.debug(f"test_net {self._oArgs.network} lenU={len(lUdpElts)} lenT={len(lTcpElts)} iMax= {iMax}")
i = 0 i = 0
while i < iMax: while i < iMax:
# if oThread and oThread._stop_thread: return # if oThread and oThread._stop_thread: return
i = i + 1 i = i + 1
LOG.debug(f"bootstrapping status # {i}") LOG.debug(f"bootstrapping status # {i}")
self._test_bootstrap(self._settings['current_nodes_udp']) self._test_bootstrap(lUdpElts)
if hasattr(self._oArgs, 'proxy_type') and self._oArgs.proxy_type > 0: if hasattr(self._oArgs, 'proxy_type') and self._oArgs.proxy_type > 0:
LOG.debug(f"relaying status # {i}") LOG.debug(f"relaying status # {i}")
self._test_relays(self._settings['current_nodes_tcp']) self._test_relays(self._settings['current_nodes_tcp'])
@ -930,9 +942,11 @@ class App:
def _test_bootstrap(self, lElts=None): def _test_bootstrap(self, lElts=None):
if lElts is None: if lElts is None:
lElts = self._settings['current_nodes_udp'] lElts = self._settings['current_nodes_udp']
shuffle(lElts)
LOG.debug(f"_test_bootstrap #Elts={len(lElts)}") LOG.debug(f"_test_bootstrap #Elts={len(lElts)}")
ts.bootstrap_good(lElts[:iNODES], [self._tox]) if not lElts:
return
shuffle(lElts)
ts.bootstrap_udp(lElts[:iNODES], [self._tox])
LOG.info("Connected status: " +repr(self._tox.self_get_connection_status())) LOG.info("Connected status: " +repr(self._tox.self_get_connection_status()))
def _test_relays(self, lElts=None): def _test_relays(self, lElts=None):

View file

@ -13,6 +13,7 @@ except ImportError:
from user_data.settings import get_user_config_path from user_data.settings import get_user_config_path
from wrapper_tests.support_testing import _get_nodes_path from wrapper_tests.support_testing import _get_nodes_path
from wrapper_tests.support_http import download_url from wrapper_tests.support_http import download_url
import wrapper_tests.support_testing as ts
global LOG global LOG
import logging import logging

View file

@ -110,7 +110,6 @@ class GroupChat(contact.Contact, ToxSave):
def get_peer_by_id(self, peer_id): def get_peer_by_id(self, peer_id):
peers = list(filter(lambda p: p.id == peer_id, self._peers)) peers = list(filter(lambda p: p.id == peer_id, self._peers))
if peers: if peers:
#? broken
return peers[0] return peers[0]
else: else:
LOG_WARN(f"get_peer_by_id empty peers for {peer_id}") LOG_WARN(f"get_peer_by_id empty peers for {peer_id}")

View file

@ -95,7 +95,7 @@ class InitThread(BaseThread):
try: try:
if self._is_first_start and ts.bAreWeConnected() and \ if self._is_first_start and ts.bAreWeConnected() and \
self._settings['download_nodes_list']: self._settings['download_nodes_list']:
LOG_INFO('downloading list of nodes') LOG_INFO(f"downloading list of nodes {self._settings['download_nodes_list']}")
download_nodes_list(self._settings, oArgs=self._app._args) download_nodes_list(self._settings, oArgs=self._app._args)
if ts.bAreWeConnected(): if ts.bAreWeConnected():

View file

@ -101,8 +101,9 @@ def tox_factory(data=None, settings=None, args=None, app=None):
LOG.debug("wrapper.tox.Tox settings: " +repr(settings)) LOG.debug("wrapper.tox.Tox settings: " +repr(settings))
if 'trace_enabled' in settings and settings['trace_enabled'] and \ if 'trace_enabled' in settings and settings['trace_enabled']:
tox_options._options_pointer: LOG_INFO("settings['trace_enabled' disabled" )
elif tox_options._options_pointer:
c_callback = CFUNCTYPE(None, c_void_p, c_int, c_char_p, c_int, c_char_p, c_char_p, c_void_p) c_callback = CFUNCTYPE(None, c_void_p, c_int, c_char_p, c_int, c_char_p, c_char_p, c_void_p)
tox_options.self_logger_cb = c_callback(tox_log_cb) tox_options.self_logger_cb = c_callback(tox_log_cb)
wrapper.tox.Tox.libtoxcore.tox_options_set_log_callback( wrapper.tox.Tox.libtoxcore.tox_options_set_log_callback(

View file

@ -362,7 +362,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionLog_console.setText(util_ui.tr("Console Log")) self.actionLog_console.setText(util_ui.tr("Console Log"))
self.actionPython_console.setText(util_ui.tr("Python Console")) self.actionPython_console.setText(util_ui.tr("Python Console"))
self.actionTest_tox.setText(util_ui.tr("Bootstrap")) self.actionTest_tox.setText(util_ui.tr("Bootstrap"))
self.actionTest_nmap.setText(util_ui.tr("Test Nmap")) self.actionTest_nmap.setText(util_ui.tr("Test Nodes"))
self.actionTest_main.setText(util_ui.tr("Test Program")) self.actionTest_main.setText(util_ui.tr("Test Program"))
self.actionQuit_program.setText(util_ui.tr("Quit program")) self.actionQuit_program.setText(util_ui.tr("Quit program"))
self.actionSettings.setText(util_ui.tr("Settings")) self.actionSettings.setText(util_ui.tr("Settings"))

View file

@ -29,9 +29,11 @@ class PeerScreen(CenteredWidget):
self.statusCircle = StatusCircle(self) self.statusCircle = StatusCircle(self)
self.statusCircle.setGeometry(50, 15, 30, 30) self.statusCircle.setGeometry(50, 15, 30, 30)
if self._peer:
self.statusCircle.update(self._peer.status) self.statusCircle.update(self._peer.status)
self.peerNameLabel.setText(self._peer.name) self.peerNameLabel.setText(self._peer.name)
self.ignorePeerCheckBox.setChecked(self._peer.is_muted) self.ignorePeerCheckBox.setChecked(self._peer.is_muted)
self.ignorePeerCheckBox.clicked.connect(self._toggle_ignore) self.ignorePeerCheckBox.clicked.connect(self._toggle_ignore)
self.sendPrivateMessagePushButton.clicked.connect(self._send_private_message) self.sendPrivateMessagePushButton.clicked.connect(self._send_private_message)
self.copyPublicKeyPushButton.clicked.connect(self._copy_public_key) self.copyPublicKeyPushButton.clicked.connect(self._copy_public_key)

View file

@ -162,7 +162,7 @@ class Settings(dict):
info = Settings.get_default_settings(app._oArgs) info = Settings.get_default_settings(app._oArgs)
if not os.path.exists(path): if not os.path.exists(path):
merge_oArgs_into_settings(app._oArgs, info) merge_args_into_settings(app._oArgs, info)
else: else:
aC = self._changed(app._oArgs, info) aC = self._changed(app._oArgs, info)
if aC: if aC:
@ -175,7 +175,7 @@ class Settings(dict):
text += repr(aC) text += repr(aC)
reply = util_ui.question(text, title) reply = util_ui.question(text, title)
if reply: if reply:
merge_oArgs_into_settings(app._oArgs, info) merge_args_into_settings(app._oArgs, info)
info['audio'] = getattr(app._oArgs, 'audio') info['audio'] = getattr(app._oArgs, 'audio')
info['video'] = getattr(app._oArgs, 'video') info['video'] = getattr(app._oArgs, 'video')
super().__init__(info) super().__init__(info)