提交 19727fab 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

all work finished! Need heavily test

上级 de8932d0
#-------------------------------------------------
#
# Project created by QtCreator 2014-02-22T21:50:54
#
#-------------------------------------------------
QT += core gui network sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ZoomPipeline_CtrlSvr
TEMPLATE = app
SOURCES += main.cpp\
maindialog.cpp
HEADERS += maindialog.h
FORMS += maindialog.ui
#include "maindialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainDialog w;
w.show();
return a.exec();
}
#include "maindialog.h"
#include "ui_maindialog.h"
MainDialog::MainDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::MainDialog)
{
ui->setupUi(this);
}
MainDialog::~MainDialog()
{
delete ui;
}
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#include <QDialog>
namespace Ui {
class MainDialog;
}
class MainDialog : public QDialog
{
Q_OBJECT
public:
explicit MainDialog(QWidget *parent = 0);
~MainDialog();
private:
Ui::MainDialog *ui;
};
#endif // MAINDIALOG_H
<ui version="4.0">
<class>MainDialog</class>
<widget class="QDialog" name="MainDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>MainDialog</string>
</property>
</widget>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
......@@ -318,6 +318,24 @@ namespace SmartLink{
m_pCluster->SendDataToRemoteServer(svr,array);
}
}
bool st_client_table::SendToNode(quint32 uuid, const QByteArray & msg)
{
bool bres = false;
m_hash_mutex.lock();
if (m_hash_uuid2node.contains(uuid))
{
st_clientNode_baseTrans * pAppLayer = qobject_cast<st_clientNode_baseTrans *>(m_hash_uuid2node[uuid]);
if (pAppLayer)
{
this->m_pThreadEngine->SendDataToClient(pAppLayer->sock(),msg);
bres = true;
}
m_hash_mutex.unlock();
}
m_hash_mutex.unlock();
return bres;
}
//this event indicates a client disconnected.
void st_client_table::on_evt_NewSvrDisconnected(const QString & svrHandle)
......
......@@ -30,7 +30,7 @@ namespace SmartLink{
bool regisitClientUUID(st_clientNode_baseTrans *);
st_clientNode_baseTrans * clientNodeFromUUID(quint32);
st_clientNode_baseTrans * clientNodeFromSocket(QObject *);
bool SendToNode(quint32 uuid, const QByteArray & msg);
//Heart beating and healthy
void KickDeadClients();
int heartBeatingThrd();
......
#include "st_cross_svr_node.h"
#include "../cluster/zp_clusterterm.h"
#include "st_client_table.h"
#include "st_message.h"
namespace SmartLink{
st_cross_svr_node::st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent)
:ZP_Cluster::zp_ClusterNode(pTerm,psock,parent)
{
m_currStMegSize = 0;
m_destin_uuid = 0xffffffff;
}
int st_cross_svr_node::st_bytesLeft()
{
......@@ -47,6 +49,7 @@ namespace SmartLink{
{
m_currStMegSize = 0;
m_currStBlock.clear();
m_destin_uuid = 0xffffffff;
}
}
return ZP_Cluster::zp_ClusterNode::deal_user_data(array);
......@@ -75,6 +78,25 @@ namespace SmartLink{
}
break;
case 0x03: // data transfer
{
if (m_destin_uuid == 0xffffffff)
{
if (m_currStMegSize >= sizeof(STCROSSSVR_MSG::tag_msgHearder)+ sizeof(SMARTLINK_MSG)-1)
{
STCROSSSVR_MSG * pMsg = (STCROSSSVR_MSG *) m_currStBlock.constData();
SMARTLINK_MSG * pSmMsg = (SMARTLINK_MSG *) pMsg->payload.data;
m_destin_uuid = pSmMsg->destin_id;
}
}
if (m_destin_uuid == 0xffffffff)
return false;
//Transfer
if (false==m_pClientTable->SendToNode(this->m_destin_uuid , m_currStBlock))
{
}
}
delCurrBlock = true;
break;
default:
......
......@@ -25,6 +25,7 @@ namespace SmartLink{
QByteArray m_currStBlock;
//current Header
STCROSSSVR_MSG::tag_msgHearder m_st_Header;
quint32 m_destin_uuid;
};
}
#endif // ST_CROSS_SVR_NODE_H
TEMPLATE = subdirs
SUBDIRS += QTcpClientTest \
ZoomPipeline_CtrlSvr
SUBDIRS += QTcpClientTest
SUBDIRS += FunctionalClientTest
SUBDIRS += ZoomPipeline_FuncSvr
TRANSLATIONS += ./ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr_zh_CN.ts
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册