141 virtual bool run(
const QString& addres,
unsigned short port);
149 QSharedPointer<QH::iParser> selectParser(
unsigned short cmd,
158 QSharedPointer<QH::iParser> selectParser(
const QString& type,
167 QSharedPointer<QH::iParser> selectParser(
const QString& type,
210 const Header *req =
nullptr);
220 const Header *req =
nullptr);
270 bool addNode(
const QString &domain,
unsigned short port,
300 QSslConfiguration getSslConfig()
const;
319 int connectionsCount()
const;
325 int confirmendCount()
const;
338 static QThread *mainThreadID();
348 bool sheduleTask(
const QSharedPointer<AbstractTask>& task);
356 void removeTask(
int taskId);
364 int sheduledTaskCount()
const;
384 const QList<QSslError> &ignoreSslErrors()
const;
392 bool addApiParser(
const QSharedPointer<iParser>& parser);
398 bool fSendBadRequestErrors()
const;
404 void setSendBadRequestErrors(
bool value);
410 bool fCloseConnectionAfterBadRequest()
const;
416 void setCloseConnectionAfterBadRequest(
bool value);
444 void setIgnoreSslErrors(
const QList<QSslError> &newIgnoreSslErrors);
451 virtual QSslConfiguration selfSignedSslConfiguration(
const EasySSL::SslSrtData& data = {});
471 virtual bool registerSocket(QAbstractSocket *socket,
const HostAddress* address =
nullptr);
482 virtual bool sendPackage(
const Package &pkg, QAbstractSocket *target)
const;
488 virtual QString getWorkStateString()
const;
494 virtual QString connectionState()
const;
500 QList<HostAddress> banedList()
const;
515 void incomingConnection(qintptr handle)
override final;
523 virtual bool changeTrust(
const HostAddress&
id,
int diff);
536 bool useSelfSignedSslConfiguration(
const EasySSL::SslSrtData& crtData);
545 bool useSystemSslConfiguration(QSslConfiguration config = QSslConfiguration::defaultConfiguration());
560 QHash<HostAddress, AbstractNodeInfo *> connections()
const;
583 void prepareForDelete()
override;
599 QList<HostAddress> connectionsList()
const;
606 QList<HostAddress> activeConnectionsList()
const;
632 template<
class ApiType,
class ... Args >
634 return addApiParserImpl(QSharedPointer<ApiType>::create(
this, std::forward<Args>(arg)...)).template staticCast<ApiType>();
643 template<
class ApiType,
class ... Args >
645 return addApiParserImpl(QSharedPointer<ApiType>::create(
this, std::forward<Args>(arg)...));
653 virtual void receivePing(
const QSharedPointer<QH::PKG::Ping>& ping);;
663 QAbstractSocket::SocketError errorCode,
664 QString errorString);
674 virtual void handleSslErrorOcurred(QH::SslSocket *scket,
const QSslError& error);
692 void handleWorkerStoped();
704 void handleBeginWork(QSharedPointer<QH::AbstractTask> work);
713 void handleSslErrorOcurredPrivate(QH::SslSocket *sender,
const QList<QSslError> & errors);
729 const QSharedPointer<iParser> & addApiParserImpl(
const QSharedPointer<QH::iParser>& parserObject);
732 ParserResult parsePackage(
const QSharedPointer<PKG::AbstractData> &pkg,
742 QSharedPointer<PKG::AbstractData>
743 genPackage(
unsigned short cmd,
749 bool listen(
const HostAddress& address = HostAddress::Any);
768 void initThreadId()
const;
773 void initThreadPool();
778 void deinitThreadPool();
781 SslMode _mode = SslMode::NoSSL;
784 QSslConfiguration _ssl;
785 QList<QSslError> _ignoreSslErrors;
787 QHash<HostAddress, AbstractNodeInfo*> _connections;
788 QHash<HostAddress, ReceiveData*> _receiveData;
792 QThread *_senderThread =
nullptr;
800 QSet<QFutureWatcher <bool>*> _workers;
801 bool _sendBadRequestErrors =
true;
802 bool _closeConnectionAfterBadRequest =
false;
804 mutable QMutex _connectionsMutex;
805 mutable QMutex _confirmNodeMutex;
806 mutable QMutex _threadPoolMutex;
807 mutable QMutex _workersMutex;
809 QThreadPool *_threadPool =
nullptr;
811 friend class WebSocketController;
812 friend class SocketFactory;
814 friend class BigDataParserOld;
816 friend class AbstractNodeParserOld;