Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
zoompipeline
提交
a41d8880
zoompipeline
项目概览
colorEagleStdio
/
zoompipeline
通知
181
Star
12
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
zoompipeline
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a41d8880
编写于
2月 28, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into smartlink_svr
上级
7266b990
6b5e3ff7
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
394 addition
and
13 deletion
+394
-13
ZoomPipeline_CtrlSvr/ZoomPipeline_CtrlSvr.pro
ZoomPipeline_CtrlSvr/ZoomPipeline_CtrlSvr.pro
+20
-0
ZoomPipeline_CtrlSvr/main.cpp
ZoomPipeline_CtrlSvr/main.cpp
+11
-0
ZoomPipeline_CtrlSvr/maindialog.cpp
ZoomPipeline_CtrlSvr/maindialog.cpp
+14
-0
ZoomPipeline_CtrlSvr/maindialog.h
ZoomPipeline_CtrlSvr/maindialog.h
+22
-0
ZoomPipeline_CtrlSvr/maindialog.ui
ZoomPipeline_CtrlSvr/maindialog.ui
+20
-0
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
+4
-2
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
+21
-0
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
+42
-0
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
+43
-0
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
+4
-0
ZoomPipeline_FuncSvr/network/zp_nettransthread.cpp
ZoomPipeline_FuncSvr/network/zp_nettransthread.cpp
+53
-6
ZoomPipeline_FuncSvr/network/zp_nettransthread.h
ZoomPipeline_FuncSvr/network/zp_nettransthread.h
+2
-0
ZoomPipeline_FuncSvr/zpmainframe.cpp
ZoomPipeline_FuncSvr/zpmainframe.cpp
+7
-3
ZoomPipeline_FuncSvr/zpmainframe.ui
ZoomPipeline_FuncSvr/zpmainframe.ui
+129
-1
zoomPipeline.pro
zoomPipeline.pro
+2
-1
未找到文件。
ZoomPipeline_CtrlSvr/ZoomPipeline_CtrlSvr.pro
0 → 100644
浏览文件 @
a41d8880
#-------------------------------------------------
#
#
Project
created
by
QtCreator
2014
-
02
-
22
T21
:
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
ZoomPipeline_CtrlSvr/main.cpp
0 → 100644
浏览文件 @
a41d8880
#include "maindialog.h"
#include <QApplication>
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
a
(
argc
,
argv
);
MainDialog
w
;
w
.
show
();
return
a
.
exec
();
}
ZoomPipeline_CtrlSvr/maindialog.cpp
0 → 100644
浏览文件 @
a41d8880
#include "maindialog.h"
#include "ui_maindialog.h"
MainDialog
::
MainDialog
(
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
MainDialog
)
{
ui
->
setupUi
(
this
);
}
MainDialog
::~
MainDialog
()
{
delete
ui
;
}
ZoomPipeline_CtrlSvr/maindialog.h
0 → 100644
浏览文件 @
a41d8880
#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
ZoomPipeline_CtrlSvr/maindialog.ui
0 → 100644
浏览文件 @
a41d8880
<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>
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
浏览文件 @
a41d8880
...
@@ -25,7 +25,8 @@ SOURCES += main.cpp\
...
@@ -25,7 +25,8 @@ SOURCES += main.cpp\
database
/
databaseresource
.
cpp
\
database
/
databaseresource
.
cpp
\
smartlink
/
st_clientnode_basetrans
.
cpp
\
smartlink
/
st_clientnode_basetrans
.
cpp
\
smartlink
/
st_clientnode_app_imp
.
cpp
\
smartlink
/
st_clientnode_app_imp
.
cpp
\
smartlink
/
st_clientnode_applayer
.
cpp
smartlink
/
st_clientnode_applayer
.
cpp
\
cluster
/
zp_clusterterm
.
cpp
HEADERS
+=
zpmainframe
.
h
\
HEADERS
+=
zpmainframe
.
h
\
network
/
zp_tcpserver
.
h
\
network
/
zp_tcpserver
.
h
\
...
@@ -40,7 +41,8 @@ HEADERS += zpmainframe.h \
...
@@ -40,7 +41,8 @@ HEADERS += zpmainframe.h \
database
/
databaseresource
.
h
\
database
/
databaseresource
.
h
\
smartlink
/
st_msg_applayer
.
h
\
smartlink
/
st_msg_applayer
.
h
\
smartlink
/
st_clientnode_basetrans
.
h
\
smartlink
/
st_clientnode_basetrans
.
h
\
smartlink
/
st_clientnode_applayer
.
h
smartlink
/
st_clientnode_applayer
.
h
\
cluster
/
zp_clusterterm
.
h
FORMS
+=
zpmainframe
.
ui
FORMS
+=
zpmainframe
.
ui
...
...
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
0 → 100644
浏览文件 @
a41d8880
#include "zp_clusterterm.h"
namespace
ZP_Cluster
{
zp_ClusterTerm
::
zp_ClusterTerm
(
const
QString
&
name
,
int
nTransThreads
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_strTermName
(
name
)
{
m_pClusterEng
=
new
ZPTaskEngine
::
zp_pipeline
(
this
);
m_pClusterNet
=
new
ZPNetwork
::
zp_net_ThreadPool
(
8192
,
this
);
m_pClusterEng
->
addThreads
(
nTransThreads
);
}
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
);
}
}
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
0 → 100644
浏览文件 @
a41d8880
#ifndef ZP_CLUSTERTERM_H
#define ZP_CLUSTERTERM_H
#include <QObject>
#include <QHostAddress>
#include "../network/zp_net_threadpool.h"
#include "../pipeline/zp_pipeline.h"
#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
,
QObject
*
parent
=
0
);
//cluster status
bool
isListening
(){
return
m_pClusterNet
->
ListenerNames
().
size
()
==
0
?
false
:
true
;}
const
QString
&
name
()
{
return
m_strTermName
;}
int
transThreads
(){
return
m_pClusterNet
->
TransThreadNum
();
}
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
();}
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
);
};
}
#endif // ZP_CLUSTERTERM_H
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
浏览文件 @
a41d8880
...
@@ -176,6 +176,7 @@ void zp_net_ThreadPool::AddClientTransThreads(int nThreads,bool bSSL)
...
@@ -176,6 +176,7 @@ void zp_net_ThreadPool::AddClientTransThreads(int nThreads,bool bSSL)
connect
(
clientTH
,
&
zp_netTransThread
::
evt_NewClientConnected
,
this
,
&
zp_net_ThreadPool
::
evt_NewClientConnected
,
Qt
::
QueuedConnection
);
connect
(
clientTH
,
&
zp_netTransThread
::
evt_NewClientConnected
,
this
,
&
zp_net_ThreadPool
::
evt_NewClientConnected
,
Qt
::
QueuedConnection
);
connect
(
clientTH
,
&
zp_netTransThread
::
evt_SocketError
,
this
,
&
zp_net_ThreadPool
::
evt_SocketError
,
Qt
::
QueuedConnection
);
connect
(
clientTH
,
&
zp_netTransThread
::
evt_SocketError
,
this
,
&
zp_net_ThreadPool
::
evt_SocketError
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_EstablishConnection
,
clientTH
,
&
zp_netTransThread
::
incomingConnection
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_EstablishConnection
,
clientTH
,
&
zp_netTransThread
::
incomingConnection
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_FireConnection
,
clientTH
,
&
zp_netTransThread
::
startConnection
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_BroadcastData
,
clientTH
,
&
zp_netTransThread
::
BroadcastData
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_BroadcastData
,
clientTH
,
&
zp_netTransThread
::
BroadcastData
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_SendDataToClient
,
clientTH
,
&
zp_netTransThread
::
SendDataToClient
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_SendDataToClient
,
clientTH
,
&
zp_netTransThread
::
SendDataToClient
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_KickAll
,
clientTH
,
&
zp_netTransThread
::
KickAllClients
,
Qt
::
QueuedConnection
);
connect
(
this
,
&
zp_net_ThreadPool
::
evt_KickAll
,
clientTH
,
&
zp_netTransThread
::
KickAllClients
,
Qt
::
QueuedConnection
);
...
@@ -206,6 +207,7 @@ bool zp_net_ThreadPool::TransThreadDel(zp_netTransThread * pThreadObj)
...
@@ -206,6 +207,7 @@ bool zp_net_ThreadPool::TransThreadDel(zp_netTransThread * pThreadObj)
disconnect
(
clientTH
,
&
zp_netTransThread
::
evt_NewClientConnected
,
this
,
&
zp_net_ThreadPool
::
evt_NewClientConnected
);
disconnect
(
clientTH
,
&
zp_netTransThread
::
evt_NewClientConnected
,
this
,
&
zp_net_ThreadPool
::
evt_NewClientConnected
);
disconnect
(
clientTH
,
&
zp_netTransThread
::
evt_SocketError
,
this
,
&
zp_net_ThreadPool
::
evt_SocketError
);
disconnect
(
clientTH
,
&
zp_netTransThread
::
evt_SocketError
,
this
,
&
zp_net_ThreadPool
::
evt_SocketError
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_EstablishConnection
,
clientTH
,
&
zp_netTransThread
::
incomingConnection
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_EstablishConnection
,
clientTH
,
&
zp_netTransThread
::
incomingConnection
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_FireConnection
,
clientTH
,
&
zp_netTransThread
::
startConnection
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_BroadcastData
,
clientTH
,
&
zp_netTransThread
::
BroadcastData
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_BroadcastData
,
clientTH
,
&
zp_netTransThread
::
BroadcastData
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_SendDataToClient
,
clientTH
,
&
zp_netTransThread
::
SendDataToClient
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_SendDataToClient
,
clientTH
,
&
zp_netTransThread
::
SendDataToClient
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_KickAll
,
clientTH
,
&
zp_netTransThread
::
KickAllClients
);
disconnect
(
this
,
&
zp_net_ThreadPool
::
evt_KickAll
,
clientTH
,
&
zp_netTransThread
::
KickAllClients
);
...
@@ -288,4 +290,45 @@ bool zp_net_ThreadPool::CanExit()
...
@@ -288,4 +290,45 @@ bool zp_net_ThreadPool::CanExit()
//m_mutex_listen.unlock();
//m_mutex_listen.unlock();
return
res
;
return
res
;
}
}
bool
zp_net_ThreadPool
::
connectTo
(
const
QHostAddress
&
address
,
quint16
nPort
,
bool
bSSLConn
)
{
bool
res
=
false
;
//m_mutex_trans.lock();
int
nsz
=
m_vec_NetTransThreads
.
size
();
int
nMinPay
=
0x7fffffff
;
int
nMinIdx
=
-
1
;
for
(
int
i
=
0
;
i
<
nsz
&&
nMinPay
!=
0
;
i
++
)
{
if
(
m_vec_NetTransThreads
[
i
]
->
isActive
()
==
false
||
m_vec_NetTransThreads
[
i
]
->
SSLConnection
()
!=
bSSLConn
)
continue
;
int
nPat
=
m_vec_NetTransThreads
[
i
]
->
CurrentClients
();
if
(
nPat
<
nMinPay
)
{
nMinPay
=
nPat
;
nMinIdx
=
i
;
}
//qDebug()<<i<<" "<<nPat<<" "<<nMinIdx;
}
for
(
int
i
=
0
;
i
<
nsz
;
i
++
)
if
(
m_vec_NetTransThreads
[
i
]
->
isActive
()
==
false
)
TransThreadDel
(
m_vec_NetTransThreads
[
i
]);
if
(
nMinIdx
>=
0
&&
nMinIdx
<
nsz
)
{
res
=
true
;
emit
evt_FireConnection
(
m_vec_NetTransThreads
[
nMinIdx
],
address
,
nPort
);
}
else
{
emit
evt_Message
(
"Waring>"
+
QString
(
tr
(
"Need Trans Thread Object for clients."
)));
}
//m_mutex_trans.unlock();
return
res
;
}
}
}
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
浏览文件 @
a41d8880
...
@@ -83,6 +83,7 @@ signals:
...
@@ -83,6 +83,7 @@ signals:
void
startListen
(
const
QString
&
id
);
void
startListen
(
const
QString
&
id
);
void
stopListen
(
const
QString
&
id
);
void
stopListen
(
const
QString
&
id
);
void
evt_EstablishConnection
(
QObject
*
threadid
,
qintptr
socketDescriptor
);
void
evt_EstablishConnection
(
QObject
*
threadid
,
qintptr
socketDescriptor
);
void
evt_FireConnection
(
QObject
*
threadid
,
const
QHostAddress
&
hostAddr
,
quint16
port
);
//Trans Control,for intenal thread usage
//Trans Control,for intenal thread usage
void
evt_SendDataToClient
(
QObject
*
objClient
,
const
QByteArray
&
dtarray
);
void
evt_SendDataToClient
(
QObject
*
objClient
,
const
QByteArray
&
dtarray
);
void
evt_BroadcastData
(
QObject
*
objFromClient
,
const
QByteArray
&
dtarray
);
void
evt_BroadcastData
(
QObject
*
objFromClient
,
const
QByteArray
&
dtarray
);
...
@@ -102,6 +103,9 @@ public slots:
...
@@ -102,6 +103,9 @@ public slots:
//Close client Immediatele
//Close client Immediatele
void
KickClients
(
QObject
*
object
);
void
KickClients
(
QObject
*
object
);
//Possive Connection Methods
bool
connectTo
(
const
QHostAddress
&
address
,
quint16
nPort
,
bool
bSSLConn
=
true
);
};
};
}
}
#endif // ZP_NET_THREADPOOL_H
#endif // ZP_NET_THREADPOOL_H
ZoomPipeline_FuncSvr/network/zp_nettransthread.cpp
浏览文件 @
a41d8880
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include <assert.h>
#include <assert.h>
#include <QDebug>
#include <QDebug>
#include <QCoreApplication>
#include <QCoreApplication>
#include <QHostAddress>
namespace
ZPNetwork
{
namespace
ZPNetwork
{
zp_netTransThread
::
zp_netTransThread
(
zp_net_ThreadPool
*
pThreadPool
,
int
nPayLoad
,
QObject
*
parent
)
:
zp_netTransThread
::
zp_netTransThread
(
zp_net_ThreadPool
*
pThreadPool
,
int
nPayLoad
,
QObject
*
parent
)
:
QObject
(
parent
)
QObject
(
parent
)
...
@@ -58,10 +59,10 @@ void zp_netTransThread::incomingConnection(QObject * threadid,qintptr socketDesc
...
@@ -58,10 +59,10 @@ void zp_netTransThread::incomingConnection(QObject * threadid,qintptr socketDesc
//Initial content
//Initial content
if
(
true
==
sock_client
->
setSocketDescriptor
(
socketDescriptor
))
if
(
true
==
sock_client
->
setSocketDescriptor
(
socketDescriptor
))
{
{
connect
(
sock_client
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
new_data_recieved
())
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
readyRead
,
this
,
&
zp_netTransThread
::
new_data_recieved
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
disconnected
()),
this
,
SLOT
(
client_closed
())
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
disconnected
,
this
,
&
zp_netTransThread
::
client_closed
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)),
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)),
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
bytesWritten
(
qint64
)),
this
,
SLOT
(
some_data_sended
(
qint64
))
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
bytesWritten
,
this
,
&
zp_netTransThread
::
some_data_sended
,
Qt
::
QueuedConnection
);
m_mutex_protect
.
lock
();
m_mutex_protect
.
lock
();
m_clientList
[
sock_client
]
=
0
;
m_clientList
[
sock_client
]
=
0
;
m_mutex_protect
.
unlock
();
m_mutex_protect
.
unlock
();
...
@@ -84,6 +85,52 @@ void zp_netTransThread::incomingConnection(QObject * threadid,qintptr socketDesc
...
@@ -84,6 +85,52 @@ void zp_netTransThread::incomingConnection(QObject * threadid,qintptr socketDesc
}
}
}
}
void
zp_netTransThread
::
startConnection
(
QObject
*
threadid
,
const
QHostAddress
&
addr
,
quint16
port
)
{
if
(
threadid
!=
this
)
return
;
QTcpSocket
*
sock_client
=
0
;
if
(
m_bSSLConnection
)
sock_client
=
new
QSslSocket
(
this
);
else
sock_client
=
new
QTcpSocket
(
this
);
if
(
sock_client
)
{
if
(
m_bSSLConnection
==
true
)
{
QSslSocket
*
psslsock
=
qobject_cast
<
QSslSocket
*>
(
sock_client
);
assert
(
psslsock
!=
NULL
);
QString
strCerPath
=
QCoreApplication
::
applicationDirPath
()
+
"/ca_cert.pem"
;
QList
<
QSslCertificate
>
lstCas
=
QSslCertificate
::
fromPath
(
strCerPath
);
psslsock
->
setCaCertificates
(
lstCas
);
connect
(
sock_client
,
&
QTcpSocket
::
readyRead
,
this
,
&
zp_netTransThread
::
new_data_recieved
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
disconnected
,
this
,
&
zp_netTransThread
::
client_closed
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)),
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
bytesWritten
,
this
,
&
zp_netTransThread
::
some_data_sended
,
Qt
::
QueuedConnection
);
connect
(
psslsock
,
&
QSslSocket
::
encrypted
,
this
,
&
zp_netTransThread
::
on_encrypted
,
Qt
::
QueuedConnection
);
m_mutex_protect
.
lock
();
m_clientList
[
sock_client
]
=
0
;
m_mutex_protect
.
unlock
();
psslsock
->
connectToHostEncrypted
(
addr
.
toString
(),
port
);
}
else
{
connect
(
sock_client
,
&
QTcpSocket
::
readyRead
,
this
,
&
zp_netTransThread
::
new_data_recieved
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
disconnected
,
this
,
&
zp_netTransThread
::
client_closed
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)),
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
bytesWritten
,
this
,
&
zp_netTransThread
::
some_data_sended
,
Qt
::
QueuedConnection
);
connect
(
sock_client
,
&
QTcpSocket
::
connected
,
this
,
&
zp_netTransThread
::
on_encrypted
,
Qt
::
QueuedConnection
);
sock_client
->
connectToHost
(
addr
,
port
);
}
}
else
assert
(
false
);
}
void
zp_netTransThread
::
on_encrypted
()
void
zp_netTransThread
::
on_encrypted
()
{
{
QTcpSocket
*
pSock
=
qobject_cast
<
QTcpSocket
*>
(
sender
());
QTcpSocket
*
pSock
=
qobject_cast
<
QTcpSocket
*>
(
sender
());
...
@@ -101,10 +148,10 @@ void zp_netTransThread::client_closed()
...
@@ -101,10 +148,10 @@ void zp_netTransThread::client_closed()
if
(
psslsock
)
if
(
psslsock
)
disconnect
(
psslsock
,
&
QSslSocket
::
encrypted
,
this
,
&
zp_netTransThread
::
on_encrypted
);
disconnect
(
psslsock
,
&
QSslSocket
::
encrypted
,
this
,
&
zp_netTransThread
::
on_encrypted
);
}
}
disconnect
(
pSock
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
new_data_recieved
())
);
disconnect
(
pSock
,
&
QTcpSocket
::
readyRead
,
this
,
&
zp_netTransThread
::
new_data_recieved
);
disconnect
(
pSock
,
SIGNAL
(
disconnected
()),
this
,
SLOT
(
client_closed
())
);
disconnect
(
pSock
,
&
QTcpSocket
::
disconnected
,
this
,
&
zp_netTransThread
::
client_closed
);
disconnect
(
pSock
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)));
disconnect
(
pSock
,
SIGNAL
(
error
(
QAbstractSocket
::
SocketError
)),
this
,
SLOT
(
displayError
(
QAbstractSocket
::
SocketError
)));
disconnect
(
pSock
,
SIGNAL
(
bytesWritten
(
qint64
)),
this
,
SLOT
(
some_data_sended
(
qint64
))
);
disconnect
(
pSock
,
&
QTcpSocket
::
bytesWritten
,
this
,
&
zp_netTransThread
::
some_data_sended
);
m_buffer_sending
.
remove
(
pSock
);
m_buffer_sending
.
remove
(
pSock
);
m_buffer_sending_offset
.
remove
(
pSock
);
m_buffer_sending_offset
.
remove
(
pSock
);
m_mutex_protect
.
lock
();
m_mutex_protect
.
lock
();
...
...
ZoomPipeline_FuncSvr/network/zp_nettransthread.h
浏览文件 @
a41d8880
...
@@ -37,6 +37,8 @@ private:
...
@@ -37,6 +37,8 @@ private:
public
slots
:
public
slots
:
//This slot dealing with multi-thread client socket accept.
//This slot dealing with multi-thread client socket accept.
void
incomingConnection
(
QObject
*
threadid
,
qintptr
socketDescriptor
);
void
incomingConnection
(
QObject
*
threadid
,
qintptr
socketDescriptor
);
//This slot dealing with possive connect to method.
void
startConnection
(
QObject
*
threadid
,
const
QHostAddress
&
addr
,
quint16
port
);
//sending dtarray to objClient. dtarray will be pushed into m_buffer_sending
//sending dtarray to objClient. dtarray will be pushed into m_buffer_sending
void
SendDataToClient
(
QObject
*
objClient
,
const
QByteArray
&
dtarray
);
void
SendDataToClient
(
QObject
*
objClient
,
const
QByteArray
&
dtarray
);
//Broadcast dtarray to every client except objFromClient itself
//Broadcast dtarray to every client except objFromClient itself
...
...
ZoomPipeline_FuncSvr/zpmainframe.cpp
浏览文件 @
a41d8880
...
@@ -17,7 +17,7 @@ ZPMainFrame::ZPMainFrame(QWidget *parent) :
...
@@ -17,7 +17,7 @@ ZPMainFrame::ZPMainFrame(QWidget *parent) :
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
//Create net engine
//Create net engine
m_netEngine
=
new
zp_net_ThreadPool
(
4096
);
m_netEngine
=
new
zp_net_ThreadPool
(
8192
);
connect
(
m_netEngine
,
&
zp_net_ThreadPool
::
evt_Message
,
this
,
&
ZPMainFrame
::
on_evt_Message
);
connect
(
m_netEngine
,
&
zp_net_ThreadPool
::
evt_Message
,
this
,
&
ZPMainFrame
::
on_evt_Message
);
connect
(
m_netEngine
,
&
zp_net_ThreadPool
::
evt_SocketError
,
this
,
&
ZPMainFrame
::
on_evt_SocketError
);
connect
(
m_netEngine
,
&
zp_net_ThreadPool
::
evt_SocketError
,
this
,
&
ZPMainFrame
::
on_evt_SocketError
);
//Create TaskEngine
//Create TaskEngine
...
@@ -146,8 +146,12 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
...
@@ -146,8 +146,12 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
str_msg
+=
tr
(
"Current Trans Threads: %1
\n
"
).
arg
(
nClientThreads
);
str_msg
+=
tr
(
"Current Trans Threads: %1
\n
"
).
arg
(
nClientThreads
);
for
(
int
i
=
0
;
i
<
nClientThreads
;
i
++
)
for
(
int
i
=
0
;
i
<
nClientThreads
;
i
++
)
str_msg
+=
tr
(
"
\t
Trans Threads %1 hold %2 Client Sockets.
\n
"
).
arg
(
i
+
1
).
arg
(
m_netEngine
->
totalClients
(
i
));
{
str_msg
+=
tr
(
"
\t
%1:%2"
).
arg
(
i
+
1
).
arg
(
m_netEngine
->
totalClients
(
i
));
if
((
i
+
1
)
%
5
==
0
)
str_msg
+=
"
\n
"
;
}
str_msg
+=
"
\n
"
;
//recording task status
//recording task status
str_msg
+=
tr
(
"Current Task Threads: %1
\n
"
).
arg
(
m_taskEngine
->
threadsCount
());
str_msg
+=
tr
(
"Current Task Threads: %1
\n
"
).
arg
(
m_taskEngine
->
threadsCount
());
str_msg
+=
tr
(
"Current Task Payload: %1
\n
"
).
arg
(
m_taskEngine
->
payload
());
str_msg
+=
tr
(
"Current Task Payload: %1
\n
"
).
arg
(
m_taskEngine
->
payload
());
...
...
ZoomPipeline_FuncSvr/zpmainframe.ui
浏览文件 @
a41d8880
...
@@ -492,6 +492,127 @@
...
@@ -492,6 +492,127 @@
</item>
</item>
</layout>
</layout>
</widget>
</widget>
<widget
class=
"QWidget"
name=
"tab_cluster"
>
<attribute
name=
"icon"
>
<iconset
resource=
"resource.qrc"
>
<normaloff>
:/icons/Resources/hanukkah_03.png
</normaloff>
:/icons/Resources/hanukkah_03.png
</iconset>
</attribute>
<attribute
name=
"title"
>
<string>
Cluster
</string>
</attribute>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_6"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_12"
>
<item>
<widget
class=
"QLabel"
name=
"label_20"
>
<property
name=
"text"
>
<string>
Terminal Address
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_cluster_term_addr"
/>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_19"
>
<property
name=
"text"
>
<string>
Terminal Port
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_cluster_term_port"
/>
</item>
<item>
<spacer
name=
"horizontalSpacer_6"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_13"
>
<item>
<widget
class=
"QLabel"
name=
"label_23"
>
<property
name=
"text"
>
<string>
Publish Name
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_cluster_pub_name"
/>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_21"
>
<property
name=
"text"
>
<string>
Publish Address
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_cluster_pub_Addr"
/>
</item>
<item>
<widget
class=
"QLabel"
name=
"label_22"
>
<property
name=
"text"
>
<string>
Publish Port
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit_cluster_pub_Port"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_cluster_apply"
>
<property
name=
"text"
>
<string>
&
Save
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"horizontalSpacer_7"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"title"
>
<string>
Active Terminals
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_14"
>
<item>
<widget
class=
"QListView"
name=
"listView_activeTerms"
>
<property
name=
"movement"
>
<enum>
QListView::Static
</enum>
</property>
<property
name=
"viewMode"
>
<enum>
QListView::IconMode
</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"tab"
>
<widget
class=
"QWidget"
name=
"tab"
>
<attribute
name=
"icon"
>
<attribute
name=
"icon"
>
<iconset
resource=
"resource.qrc"
>
<iconset
resource=
"resource.qrc"
>
...
@@ -503,6 +624,13 @@
...
@@ -503,6 +624,13 @@
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_5"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_5"
>
<item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_9"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_9"
>
<item>
<widget
class=
"QPushButton"
name=
"pushButton_smartlink_save"
>
<property
name=
"text"
>
<string>
&
Save
</string>
</property>
</widget>
</item>
<item>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<property
name=
"text"
>
...
@@ -639,7 +767,7 @@
...
@@ -639,7 +767,7 @@
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
556
</width>
<width>
556
</width>
<height>
2
1
</height>
<height>
2
3
</height>
</rect>
</rect>
</property>
</property>
<widget
class=
"QMenu"
name=
"menu_Control"
>
<widget
class=
"QMenu"
name=
"menu_Control"
>
...
...
zoomPipeline.pro
浏览文件 @
a41d8880
TEMPLATE
=
subdirs
TEMPLATE
=
subdirs
SUBDIRS
+=
QTcpClientTest
SUBDIRS
+=
QTcpClientTest
\
ZoomPipeline_CtrlSvr
SUBDIRS
+=
FunctionalClientTest
SUBDIRS
+=
FunctionalClientTest
SUBDIRS
+=
ZoomPipeline_FuncSvr
SUBDIRS
+=
ZoomPipeline_FuncSvr
TRANSLATIONS
+=
.
/
ZoomPipeline_FuncSvr
/
ZoomPipeline_FuncSvr_zh_CN
.
ts
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录