diff --git a/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp b/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp index 247e041c80001aed9e9c0a66cff9b65007ab3dc5..3eaf9d3bb699e6dee439bc78595c3dcb8747d25a 100644 --- a/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp +++ b/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp @@ -1,26 +1,24 @@ #include "zp_clusterterm.h" namespace ZP_Cluster{ -zp_ClusterTerm::zp_ClusterTerm(const QString & name,int nTransThreads ,int nWorkingThreads,QObject *parent ) : - QObject(parent) - ,m_strTermName(name) -{ - m_pClusterEng = new ZPTaskEngine::zp_pipeline(this); - m_pClusterEng->addThreads(nWorkingThreads); - m_pClusterNet = new ZPNetwork::zp_net_ThreadPool(8192,this); - m_pClusterNet->AddClientTransThreads(nTransThreads); + zp_ClusterTerm::zp_ClusterTerm(const QString & name,QObject *parent ) : + QObject(parent) + ,m_strTermName(name) + { + m_pClusterEng = new ZPTaskEngine::zp_pipeline(this); + m_pClusterNet = new ZPNetwork::zp_net_ThreadPool(8192,this); -} -void zp_ClusterTerm::StartListen(const QHostAddress &addr, int nPort) -{ - m_pClusterNet->AddListeningAddress(m_strTermName,addr,nPort,false); + } + void zp_ClusterTerm::StartListen(const QHostAddress &addr, int nPort) + { + m_pClusterNet->AddListeningAddress(m_strTermName,addr,nPort,false); -} -bool zp_ClusterTerm::JoinCluster(const QHostAddress &addr, int nPort) -{ - return m_pClusterNet->connectTo(addr,nPort); -} -bool zp_ClusterTerm::canExit() -{ - return m_pClusterEng->canClose() && m_pClusterNet->CanExit(); -} + } + bool zp_ClusterTerm::JoinCluster(const QHostAddress &addr, int nPort) + { + return m_pClusterNet->connectTo(addr,nPort); + } + bool zp_ClusterTerm::canExit() + { + return m_pClusterEng->canClose() && m_pClusterNet->CanExit(); + } } diff --git a/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h b/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h index 4176446d00d7af854f897a077073cc8844aa3031..fcc4d9504bd8445dffb8d9256657388e8bde4fa0 100644 --- a/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h +++ b/ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h @@ -8,31 +8,31 @@ #include "../pipeline/zp_pltaskbase.h" namespace ZP_Cluster{ -//!this class enable server processes can -//! communicate with each other. -class zp_ClusterTerm : public QObject -{ - Q_OBJECT -public: - explicit zp_ClusterTerm(const QString & name,int nTransThreads = 4,int nWorkingThreads = 4,QObject *parent = 0); - //cluster status - ZPNetwork::zp_net_ThreadPool * netEng() {return m_pClusterNet;} - ZPTaskEngine::zp_pipeline * taskEng() {return m_pClusterEng;} - bool canExit(); -protected: - QString m_strTermName;//the Terminal's name - ZPNetwork::zp_net_ThreadPool * m_pClusterNet; - ZPTaskEngine::zp_pipeline * m_pClusterEng; -signals: + //!this class enable server processes can + //! communicate with each other. + class zp_ClusterTerm : public QObject + { + Q_OBJECT + public: + explicit zp_ClusterTerm(const QString & name,QObject *parent = 0); + //cluster status + ZPNetwork::zp_net_ThreadPool * netEng() {return m_pClusterNet;} + ZPTaskEngine::zp_pipeline * taskEng() {return m_pClusterEng;} + bool canExit(); + protected: + QString m_strTermName;//the Terminal's name + ZPNetwork::zp_net_ThreadPool * m_pClusterNet; + ZPTaskEngine::zp_pipeline * m_pClusterEng; + signals: -public slots: - //!Start listen, this term can be connected by newly joined terms in future. - void StartListen(const QHostAddress &addr, int nPort); - //!Join cluster, using existing term (addr:nPort) - //!as soon as connection established, more existing terms will be sent to this term, - //!an p2p connection will start - bool JoinCluster(const QHostAddress &addr, int nPort); + public slots: + //!Start listen, this term can be connected by newly joined terms in future. + void StartListen(const QHostAddress &addr, int nPort); + //!Join cluster, using existing term (addr:nPort) + //!as soon as connection established, more existing terms will be sent to this term, + //!an p2p connection will start + bool JoinCluster(const QHostAddress &addr, int nPort); -}; + }; } #endif // ZP_CLUSTERTERM_H