提交 3a8660d0 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Add little funcs

上级 1a00ce7f
...@@ -12,31 +12,26 @@ namespace ZP_Cluster{ ...@@ -12,31 +12,26 @@ namespace ZP_Cluster{
//! communicate with each other. //! communicate with each other.
class zp_ClusterTerm : public QObject class zp_ClusterTerm : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit zp_ClusterTerm(const QString & name,int nTransThreads = 4,int nWorkingThreads = 4,QObject *parent = 0); explicit zp_ClusterTerm(const QString & name,int nTransThreads = 4,int nWorkingThreads = 4,QObject *parent = 0);
//cluster status //cluster status
bool isListening(){ return m_pClusterNet->ListenerNames().size()==0?false:true;} ZPNetwork::zp_net_ThreadPool * netEng() {return m_pClusterNet;}
const QString & name() {return m_strTermName;} ZPTaskEngine::zp_pipeline * taskEng() {return m_pClusterEng;}
int transThreads(){ return m_pClusterNet->TransThreadNum(); } bool canExit();
int transClients(int idx){ return m_pClusterNet->totalClients(idx);}
int payload(){ return m_pClusterEng->payload();}
int threadsCount(){ return m_pClusterEng->threadsCount();}
int threadsIdel(){ return m_pClusterEng->idleThreads();}
bool canExit();
protected: protected:
QString m_strTermName;//the Terminal's name QString m_strTermName;//the Terminal's name
ZPNetwork::zp_net_ThreadPool * m_pClusterNet; ZPNetwork::zp_net_ThreadPool * m_pClusterNet;
ZPTaskEngine::zp_pipeline * m_pClusterEng; ZPTaskEngine::zp_pipeline * m_pClusterEng;
signals: signals:
public slots: public slots:
//!Start listen, this term can be connected by newly joined terms in future. //!Start listen, this term can be connected by newly joined terms in future.
void StartListen(const QHostAddress &addr, int nPort); void StartListen(const QHostAddress &addr, int nPort);
//!Join cluster, using existing term (addr:nPort) //!Join cluster, using existing term (addr:nPort)
//!as soon as connection established, more existing terms will be sent to this term, //!as soon as connection established, more existing terms will be sent to this term,
//!an p2p connection will start //!an p2p connection will start
bool JoinCluster(const QHostAddress &addr, int nPort); bool JoinCluster(const QHostAddress &addr, int nPort);
}; };
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册