提交 08b7ccdc 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Tested in Ubuntu 14.04

上级 8fbfa1fc
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#------------------------------------------------- #-------------------------------------------------
QT += core gui network sql QT += core gui network sql
unix:QMAKE_CXXFLAGS += -std=c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ZoomPipeline_FuncSvr TARGET = ZoomPipeline_FuncSvr
......
#include "st_client_table.h" #include "st_client_table.h"
#include "st_clientnode_applayer.h" #include "st_clientnode_applayer.h"
#include <assert.h> #include <assert.h>
#include "st_cross_svr_node.h"
#include <functional>
namespace SmartLink{ namespace SmartLink{
using namespace std::placeholders;
st_client_table::st_client_table( st_client_table::st_client_table(
ZPNetwork::zp_net_Engine * NetEngine, ZPNetwork::zp_net_Engine * NetEngine,
ZPTaskEngine::zp_pipeline * taskeng, ZPTaskEngine::zp_pipeline * taskeng,
...@@ -25,8 +28,11 @@ namespace SmartLink{ ...@@ -25,8 +28,11 @@ namespace SmartLink{
connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_NewSvrDisconnected,this,&st_client_table::on_evt_NewSvrDisconnected,Qt::QueuedConnection); connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_NewSvrDisconnected,this,&st_client_table::on_evt_NewSvrDisconnected,Qt::QueuedConnection);
connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_recieved,this,&st_client_table::on_evt_RemoteData_recieved,Qt::QueuedConnection); connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_recieved,this,&st_client_table::on_evt_RemoteData_recieved,Qt::QueuedConnection);
connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_transferred,this,&st_client_table::on_evt_RemoteData_transferred,Qt::QueuedConnection); connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_transferred,this,&st_client_table::on_evt_RemoteData_transferred,Qt::QueuedConnection);
Reg_st_cross_svr_node(m_pCluster); m_pCluster->SetNodeFactory(
std::bind(&st_client_table::cross_svr_node_factory,
this,
_1,_2,_3)
);
} }
int st_client_table::heartBeatingThrd() int st_client_table::heartBeatingThrd()
...@@ -290,6 +296,14 @@ namespace SmartLink{ ...@@ -290,6 +296,14 @@ namespace SmartLink{
{ {
} }
ZP_Cluster::zp_ClusterNode * st_client_table::cross_svr_node_factory(
ZP_Cluster::zp_ClusterTerm * pTerm,
QObject * psock,
QObject * parent)
{
st_cross_svr_node * pNode = new st_cross_svr_node(pTerm,psock,parent);
pNode->setClientTable(this);
return pNode;
}
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <QList> #include <QList>
#include <QMutex> #include <QMutex>
#include <QMap> #include <QMap>
#include <hash_map> #include <unordered_map>
#include "../network/zp_net_threadpool.h" #include "../network/zp_net_threadpool.h"
#include "../pipeline/zp_pipeline.h" #include "../pipeline/zp_pipeline.h"
#include "./st_message.h" #include "./st_message.h"
...@@ -26,6 +26,7 @@ namespace SmartLink{ ...@@ -26,6 +26,7 @@ namespace SmartLink{
,QObject *parent = 0); ,QObject *parent = 0);
~st_client_table(); ~st_client_table();
bool regisitClientUUID(st_clientNode_baseTrans *); bool regisitClientUUID(st_clientNode_baseTrans *);
st_clientNode_baseTrans * clientNodeFromUUID(quint32); st_clientNode_baseTrans * clientNodeFromUUID(quint32);
st_clientNode_baseTrans * clientNodeFromSocket(QObject *); st_clientNode_baseTrans * clientNodeFromSocket(QObject *);
...@@ -70,8 +71,12 @@ namespace SmartLink{ ...@@ -70,8 +71,12 @@ namespace SmartLink{
QString m_largeFileFolder; QString m_largeFileFolder;
//cluster Nodes Map //cluster Nodes Map
std::hash_map<quint32,QString> m_hash_remoteClient2SvrName; std::unordered_map<quint32,QString> m_hash_remoteClient2SvrName;
//Cluster Node Factory
ZP_Cluster::zp_ClusterNode * cross_svr_node_factory(
ZP_Cluster::zp_ClusterTerm * /*pTerm*/,
QObject * /*psock*/,
QObject * /*parent*/);
signals: signals:
......
#include "st_cross_svr_node.h" #include "st_cross_svr_node.h"
#include "../cluster/zp_clusterterm.h" #include "../cluster/zp_clusterterm.h"
#include "st_client_table.h"
namespace SmartLink{ namespace SmartLink{
ZP_Cluster::zp_ClusterNode * st_cross_svr_node_factory(
ZP_Cluster::zp_ClusterTerm * pTerm,
QObject * psock,
QObject * parent)
{
return new st_cross_svr_node(pTerm,psock,parent);
}
void Reg_st_cross_svr_node(ZP_Cluster::zp_ClusterTerm *pTerm )
{
pTerm->SetNodeFactory(st_cross_svr_node_factory);
}
st_cross_svr_node::st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent) st_cross_svr_node::st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent)
:ZP_Cluster::zp_ClusterNode(pTerm,psock,parent) :ZP_Cluster::zp_ClusterNode(pTerm,psock,parent)
...@@ -22,5 +11,9 @@ namespace SmartLink{ ...@@ -22,5 +11,9 @@ namespace SmartLink{
{ {
return ZP_Cluster::zp_ClusterNode::deal_user_data(array); return ZP_Cluster::zp_ClusterNode::deal_user_data(array);
} }
void st_cross_svr_node::setClientTable(st_client_table * table)
{
this->m_pClientTable = table;
}
} }
...@@ -2,22 +2,18 @@ ...@@ -2,22 +2,18 @@
#define ST_CROSS_SVR_NODE_H #define ST_CROSS_SVR_NODE_H
#include "../cluster/zp_clusternode.h" #include "../cluster/zp_clusternode.h"
namespace SmartLink{ namespace SmartLink{
class st_client_table;
ZP_Cluster::zp_ClusterNode * st_cross_svr_node_factory(
ZP_Cluster::zp_ClusterTerm * /*pTerm*/,
QObject * /*psock*/,
QObject * /*parent*/);
void Reg_st_cross_svr_node(ZP_Cluster::zp_ClusterTerm *pTerm );
class st_cross_svr_node : public ZP_Cluster::zp_ClusterNode class st_cross_svr_node : public ZP_Cluster::zp_ClusterNode
{ {
Q_OBJECT Q_OBJECT
public: public:
st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent); st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent);
void setClientTable(st_client_table * table);
protected: protected:
//!virtual functions, dealing with the user-defined operations. //!virtual functions, dealing with the user-defined operations.
virtual bool deal_user_data(const QByteArray &); virtual bool deal_user_data(const QByteArray &);
protected:
st_client_table * m_pClientTable;
}; };
} }
#endif // ST_CROSS_SVR_NODE_H #endif // ST_CROSS_SVR_NODE_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册