diff options
| author | Anton <anton@picapica.im> | 2026-08-12 03:16:21 +0400 |
|---|---|---|
| committer | Anton <anton@picapica.im> | 2026-08-12 03:16:21 +0400 |
| commit | 3c1dd02283dc732038bd730a677fed519305e01b (patch) | |
| tree | 990b50d69955e03eb818be12bc3fe07bbfa20a5d | |
| parent | cf44fd4cd45ed571a36cda5065158d29bdbe0c7b (diff) | |
| download | pica-pica-3c1dd02283dc732038bd730a677fed519305e01b.tar.gz pica-pica-3c1dd02283dc732038bd730a677fed519305e01b.zip | |
pica-client: remove dead code, NodeThread class
| -rw-r--r-- | pica-client/nodethread.cpp | 118 | ||||
| -rw-r--r-- | pica-client/nodethread.h | 40 | ||||
| -rw-r--r-- | pica-client/skynet.cpp | 10 |
3 files changed, 0 insertions, 168 deletions
diff --git a/pica-client/nodethread.cpp b/pica-client/nodethread.cpp deleted file mode 100644 index bf93e83..0000000 --- a/pica-client/nodethread.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "nodethread.h" -#include "mainwindow.h" -#include "../PICA_proto.h" -#include "globals.h" -#include "dhparam.h" - -QMutex NodeThread::finished_mutex; - -NodeThread::NodeThread(Nodes::NodeRecord &addr, bool *completed, PICA_acc *acc, PICA_c2n **pica_conn, QMutex *wm) : - QThread(0) -{ - node_addr = addr; - finished_flag = completed; - user_account = acc; - connection = pica_conn; - write_mutex = wm; - exit = 0; - start(); -} - -void NodeThread::run() -{ - int ret; - exit = 0; - - /*ret = PICA_new_c2n(node_addr.address.toUtf8().constData(), - node_addr.port, - user_account.CA_file.toUtf8().constData(), - user_account.cert_file.toUtf8().constData(), - user_account.pkey_file.toUtf8().constData(), - DHParam::GetDHParamFilename().toUtf8().constData(), - AskPassword::ask_password_cb, - &ci);*/ - ret = PICA_new_c2n(user_account, node_addr.address.toUtf8().constData(), node_addr.port, &ci); - - switch(ret) - { - case PICA_OK: - - emit NodeStatusChanged(node_addr.address, node_addr.port, true); - - finished_mutex.lock(); - if (*finished_flag) - { - PICA_close_c2n(ci); - exit = 1; - } - else - { - *finished_flag = true; - *connection = ci; - emit ConnectedToNode(node_addr.address, node_addr.port, this); - } - finished_mutex.unlock(); - - - - break; - - case PICA_ERRSOCK: - case PICA_ERRDNSRESOLVE: - - emit NodeStatusChanged(node_addr.address, node_addr.port, false); - - exit = 1; - break; - - case PICA_ERRSSL: - exit = 1; - break; - - case PICA_ERRPROTONEW: - - emit ErrorMsg(QString("Node %1:%2 has newer protocol version. Please check if update for pica-client is available") - .arg(node_addr.address) - .arg(node_addr.port) - ); - exit = 1; - break; - - case PICA_ERRPROTOOLD: - - emit ErrorMsg(QString("Node %1:%2 has older protocol. Disconnected.") - .arg(node_addr.address) - .arg(node_addr.port) - ); - - exit = 1; - break; - - default: - exit = 1; - } - - if (exit) - return; - - do - { - write_mutex->lock(); - if (PICA_read(ci, 10000) != PICA_OK || PICA_write(ci) != PICA_OK) - exit = 1; - write_mutex->unlock(); - msleep(300); - } - while (!exit); - - write_mutex->lock(); - PICA_close_c2n(ci); - *connection = NULL; - write_mutex->unlock(); -} - -void NodeThread::CloseThread() -{ - exit = 1; -} - diff --git a/pica-client/nodethread.h b/pica-client/nodethread.h deleted file mode 100644 index d7154a1..0000000 --- a/pica-client/nodethread.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef NODETHREAD_H -#define NODETHREAD_H - -#include <QThread> -#include <QMutex> -#include "nodes.h" -#include "../PICA_client.h" -#include "accounts.h" - - -class NodeThread : public QThread -{ - Q_OBJECT -public: - explicit NodeThread( Nodes::NodeRecord &addr, bool *completed, PICA_acc *acc, struct PICA_c2n **pica_conn, QMutex *wm); - void CloseThread(); -private: - void run(); - static QMutex finished_mutex; - - QMutex *write_mutex; - - bool *finished_flag; - Nodes::NodeRecord node_addr; - struct PICA_c2n *ci; - struct PICA_acc *user_account; - struct PICA_c2n **connection; - - int exit; - - -signals: - void NodeStatusChanged(QString addr, quint16 port, bool alive); - void ConnectedToNode(QString addr, quint16 port, NodeThread *thread); - void ErrorMsg(QString msg); -public slots: - -}; - -#endif // NODETHREAD_H diff --git a/pica-client/skynet.cpp b/pica-client/skynet.cpp index 8c6d404..85a55f6 100644 --- a/pica-client/skynet.cpp +++ b/pica-client/skynet.cpp @@ -543,16 +543,6 @@ void SkyNet::do_Join(const Accounts::AccountRecord &accrec) node_status_changed(noderecords[i], false); } } - /* - for (int i=0;i<nodelist.count() && !self_aware;i++) - {//TODO FIXME сделать запуск потоков порциями, а не все сразу - threads.append(new NodeThread(nodelist[i],&self_aware, acc,&nodelink, &write_mutex)); - connect(threads.last(), SIGNAL(finished()),this,SLOT(nodethread_finished())); - connect(threads.last(), SIGNAL(NodeStatusChanged(QString,quint16,bool)), this, SLOT(node_status_changed(QString,quint16,bool))); - connect(threads.last(), SIGNAL(ConnectedToNode(QString,quint16,NodeThread*)), this, SLOT(nodethread_connected(QString,quint16,NodeThread*))); - connect(threads.last(), SIGNAL(ErrorMsg(QString)), this, SIGNAL(ErrMsgFromNode(QString))); - }*/ - } void SkyNet::Exit() |
