Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蚂蚁寻路
zoompipeline
提交
95d3c5cb
zoompipeline
项目概览
蚂蚁寻路
/
zoompipeline
与 Fork 源项目一致
Fork自
colorEagleStdio / zoompipeline
通知
4
Star
1
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
95d3c5cb
编写于
4月 21, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Debug some fault-codes
上级
45feefce
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
330 addition
and
321 deletion
+330
-321
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
+3
-0
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr_zh_CN.ts
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr_zh_CN.ts
+260
-189
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
+9
-35
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
+0
-3
ZoomPipeline_FuncSvr/zpmainframe.cpp
ZoomPipeline_FuncSvr/zpmainframe.cpp
+55
-77
ZoomPipeline_FuncSvr/zpmainframe.h
ZoomPipeline_FuncSvr/zpmainframe.h
+3
-3
ZoomPipeline_FuncSvr/zpmainframe.ui
ZoomPipeline_FuncSvr/zpmainframe.ui
+0
-14
未找到文件。
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro
浏览文件 @
95d3c5cb
...
...
@@ -53,3 +53,6 @@ FORMS += zpmainframe.ui \
RESOURCES
+=
\
resource
.
qrc
OTHER_FILES
+=
\
ZoomPipeline_FuncSvr_zh_CN
.
ts
ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr_zh_CN.ts
浏览文件 @
95d3c5cb
此差异已折叠。
点击以展开。
ZoomPipeline_FuncSvr/network/zp_net_threadpool.cpp
浏览文件 @
95d3c5cb
#include "zp_net_threadpool.h"
#include <QCoreApplication>
#include <QStringList>
#include <QTcpSocket>
#include <QSslSocket>
namespace
ZPNetwork
{
/**
* @brief Construct a net thread pool object.
...
...
@@ -82,33 +81,6 @@ namespace ZPNetwork{
return
0
;
}
QString
zp_net_ThreadPool
::
GenSockMsg
(
QObject
*
pSock
)
{
QString
msg
;
msg
+=
tr
(
"Obj=%1"
).
arg
((
unsigned
int
)
pSock
);
QTcpSocket
*
pSocket
=
qobject_cast
<
QTcpSocket
*>
(
pSock
);
QTcpSocket
*
pSocketSSL
=
qobject_cast
<
QSslSocket
*>
(
pSock
);
if
(
pSocketSSL
)
{
msg
+=
tr
(
",SSLSock,Local=(%1:%2),Peer=%3(%4:%5)"
)
.
arg
(
pSocket
->
localAddress
().
toString
())
.
arg
(
pSocket
->
localPort
())
.
arg
(
pSocket
->
peerName
())
.
arg
(
pSocket
->
peerAddress
().
toString
())
.
arg
(
pSocket
->
peerPort
());
}
else
if
(
pSocket
)
{
msg
+=
tr
(
",TcpSock,Local=(%1:%2),Peer=%3(%4:%5)"
)
.
arg
(
pSocket
->
localAddress
().
toString
())
.
arg
(
pSocket
->
localPort
())
.
arg
(
pSocket
->
peerName
())
.
arg
(
pSocket
->
peerAddress
().
toString
())
.
arg
(
pSocket
->
peerPort
());
}
return
msg
;
}
/**
* @brief Begin a listening socket at special address and port. The socket will be activated as soon as possible
* The Wait-and-Accept approaches are all managed by Listening thread, instead of main-GUI thread.
...
...
@@ -207,9 +179,10 @@ namespace ZPNetwork{
}
//qDebug()<<i<<" "<<nPat<<" "<<nMinIdx;
}
// for (int i=0;i<nsz;i++)
// if (m_vec_NetTransThreads[i]->isActive()==false )
// TransThreadDel(m_vec_NetTransThreads[i]);
//remove old threads
for
(
int
i
=
0
;
i
<
nsz
;
i
++
)
if
(
m_vec_NetTransThreads
[
i
]
->
isActive
()
==
false
)
TransThreadDel
(
m_vec_NetTransThreads
[
i
]);
if
(
nMinIdx
>=
0
&&
nMinIdx
<
nsz
)
emit
evt_EstablishConnection
(
m_vec_NetTransThreads
[
nMinIdx
],
socketDescriptor
);
...
...
@@ -483,9 +456,10 @@ namespace ZPNetwork{
}
//qDebug()<<i<<" "<<nPat<<" "<<nMinIdx;
}
// for (int i=0;i<nsz;i++)
// if (m_vec_NetTransThreads[i]->isActive()==false )
// TransThreadDel(m_vec_NetTransThreads[i]);
//remove old threads
for
(
int
i
=
0
;
i
<
nsz
;
i
++
)
if
(
m_vec_NetTransThreads
[
i
]
->
isActive
()
==
false
)
TransThreadDel
(
m_vec_NetTransThreads
[
i
]);
if
(
nMinIdx
>=
0
&&
nMinIdx
<
nsz
)
{
...
...
ZoomPipeline_FuncSvr/network/zp_net_threadpool.h
浏览文件 @
95d3c5cb
...
...
@@ -28,9 +28,6 @@ namespace ZPNetwork{
public:
explicit
zp_net_ThreadPool
(
int
nPayLoad
=
4096
,
QObject
*
parent
=
0
);
// Dump errmessage
static
QString
GenSockMsg
(
QObject
*
pSock
);
//Listening Ctrl
//Begin a listening socket at special address and port. The socket will be activated as soon as possible
void
AddListeningAddress
(
const
QString
&
id
,
const
QHostAddress
&
address
,
quint16
nPort
,
bool
bSSLConn
=
true
);
...
...
ZoomPipeline_FuncSvr/zpmainframe.cpp
浏览文件 @
95d3c5cb
...
...
@@ -7,6 +7,9 @@
#include <QFileDialog>
#include <QSqlDatabase>
#include <QMap>
#include <QTcpSocket>
#include <QSslSocket>
#include "smartlink/st_clientnode_basetrans.h"
#include "dialogaddressinput.h"
using
namespace
ZPNetwork
;
using
namespace
ZPTaskEngine
;
...
...
@@ -20,7 +23,7 @@ ZPMainFrame::ZPMainFrame(QWidget *parent) :
//Create net engine
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
Network
);
connect
(
m_netEngine
,
&
zp_net_ThreadPool
::
evt_SocketError
,
this
,
&
ZPMainFrame
::
on_evt_SocketError
);
//Create TaskEngine
m_taskEngine
=
new
zp_pipeline
(
this
);
...
...
@@ -64,12 +67,22 @@ ZPMainFrame::~ZPMainFrame()
m_pClusterTerm
->
netEng
()
->
KickAllClients
();
m_pClusterTerm
->
netEng
()
->
DeactiveImmediately
();
m_pClusterTerm
->
taskEng
()
->
removeThreads
(
-
1
);
int
maxWait
=
0
;
while
(
m_netEngine
->
CanExit
()
==
false
||
m_taskEngine
->
canClose
()
==
false
||
m_pDatabases
->
isRunning
()
==
true
||
m_pClusterTerm
->
canExit
()
==
false
)
{
QCoreApplication
::
processEvents
();
QThread
::
currentThread
()
->
msleep
(
200
);
maxWait
++
;
if
(
maxWait
>=
150
)
{
if
(
QMessageBox
::
information
(
0
,
tr
(
"Confire Exit"
),
tr
(
"There are still some clients alive in the server. continue waiting?"
),
QMessageBox
::
Yes
|
QMessageBox
::
No
)
==
QMessageBox
::
Yes
)
maxWait
=
0
;
else
break
;
}
}
delete
ui
;
...
...
@@ -90,12 +103,10 @@ void ZPMainFrame::changeEvent(QEvent *e)
void
ZPMainFrame
::
initUI
()
{
//Message Shown model
m_pMsgModel
=
new
QStandardItemModel
(
this
);
ui
->
listView_msg
->
setModel
(
m_pMsgModel
);
m_pMsgModel
Network
=
new
QStandardItemModel
(
this
);
ui
->
listView_msg
->
setModel
(
m_pMsgModel
Network
);
m_pMsgModelCluster
=
new
QStandardItemModel
(
this
);
ui
->
listView_msg_cluster
->
setModel
(
m_pMsgModelCluster
);
m_pMsgModelDebug
=
new
QStandardItemModel
(
this
);
ui
->
listView_msg_debug
->
setModel
(
m_pMsgModelDebug
);
m_pMsgModelDatabase
=
new
QStandardItemModel
(
this
);
ui
->
listView_msg_database
->
setModel
(
m_pMsgModelDatabase
);
m_pMsgModelSmartlink
=
new
QStandardItemModel
(
this
);
...
...
@@ -128,67 +139,39 @@ void ZPMainFrame::initUI()
ui
->
comboBox_db_type
->
setModel
(
pCombo
);
}
void
ZPMainFrame
::
on_evt_Message
(
QObject
*
psource
,
const
QString
&
strMsg
)
void
ZPMainFrame
::
on_evt_MessageNetwork
(
QObject
*
psource
,
const
QString
&
strMsg
)
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
strMsg
;
if
(
strMsg
.
left
(
5
)
==
QString
(
"Debug"
))
{
int
nrows
=
m_pMsgModelDebug
->
rowCount
();
m_pMsgModelDebug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelDebug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
}
else
{
int
nrows
=
m_pMsgModel
->
rowCount
();
m_pMsgModel
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModel
->
removeRow
(
m_pMsgModel
->
rowCount
()
-
1
);
}
msg
+=
tr
(
",Source=%1"
).
arg
((
unsigned
int
)
psource
);
int
nrows
=
m_pMsgModelNetwork
->
rowCount
();
m_pMsgModelNetwork
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModelNetwork
->
removeRow
(
m_pMsgModelNetwork
->
rowCount
()
-
1
);
}
void
ZPMainFrame
::
on_evt_Message_Database
(
QObject
*
psource
,
const
QString
&
strMsg
)
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
strMsg
;
if
(
strMsg
.
left
(
5
)
==
QString
(
"Debug"
))
{
int
nrows
=
m_pMsgModelDebug
->
rowCount
();
m_pMsgModelDebug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelDebug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
}
else
{
int
nrows
=
m_pMsgModelDatabase
->
rowCount
();
m_pMsgModelDatabase
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelDatabase
->
removeRow
(
m_pMsgModelDatabase
->
rowCount
()
-
1
);
}
msg
+=
tr
(
",Source=%1"
).
arg
((
unsigned
int
)
psource
);
int
nrows
=
m_pMsgModelDatabase
->
rowCount
();
m_pMsgModelDatabase
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModelDatabase
->
removeRow
(
m_pMsgModelDatabase
->
rowCount
()
-
1
);
}
void
ZPMainFrame
::
on_evt_Message_Smartlink
(
QObject
*
psource
,
const
QString
&
strMsg
)
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
strMsg
;
if
(
strMsg
.
left
(
5
)
==
QString
(
"Debug"
))
{
int
nrows
=
m_pMsgModelDebug
->
rowCount
();
m_pMsgModelDebug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelDebug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
}
else
{
int
nrows
=
m_pMsgModelSmartlink
->
rowCount
();
m_pMsgModelSmartlink
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelSmartlink
->
removeRow
(
m_pMsgModelSmartlink
->
rowCount
()
-
1
);
}
msg
+=
tr
(
",Source=%1"
).
arg
((
unsigned
int
)
psource
);
int
nrows
=
m_pMsgModelSmartlink
->
rowCount
();
m_pMsgModelSmartlink
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModelSmartlink
->
removeRow
(
m_pMsgModelSmartlink
->
rowCount
()
-
1
);
}
//The socket error message
...
...
@@ -197,10 +180,10 @@ void ZPMainFrame::on_evt_SocketError(QObject * senderSock ,QAbstractSocket::Soc
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
QString
(
"SockError %1 with code %2"
)
.
arg
((
quint64
)
senderSock
).
arg
((
quint32
)
socketError
);
int
nrows
=
m_pMsgModel
Debug
->
rowCount
();
m_pMsgModel
Debug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModel
Debug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
int
nrows
=
m_pMsgModel
Network
->
rowCount
();
m_pMsgModel
Network
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModel
Network
->
removeRow
(
m_pMsgModelNetwork
->
rowCount
()
-
1
);
}
...
...
@@ -208,33 +191,23 @@ void ZPMainFrame::on_evt_Message_Cluster(QObject * psource,const QString & strM
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
strMsg
;
if
(
strMsg
.
left
(
5
)
==
QString
(
"Debug"
))
{
int
nrows
=
m_pMsgModelDebug
->
rowCount
();
m_pMsgModelDebug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelDebug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
}
else
{
int
nrows
=
m_pMsgModelCluster
->
rowCount
();
m_pMsgModelCluster
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModelCluster
->
removeRow
(
m_pMsgModelCluster
->
rowCount
()
-
1
);
}
msg
+=
tr
(
",Source=%1"
).
arg
((
unsigned
int
)
psource
);
int
nrows
=
m_pMsgModelCluster
->
rowCount
();
m_pMsgModelCluster
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModelCluster
->
removeRow
(
m_pMsgModelCluster
->
rowCount
()
-
1
);
}
//The socket error message
void
ZPMainFrame
::
on_evt_SocketError_Cluster
(
QObject
*
senderSock
,
QAbstractSocket
::
SocketError
socketError
)
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
"
(Cluster)
"
+
QString
(
"SockError %1 with code %2"
)
QString
msg
=
dtm
.
toString
(
"yyyy-MM-dd HH:mm:ss.zzz"
)
+
" "
+
QString
(
"SockError %1 with code %2"
)
.
arg
((
quint64
)
senderSock
).
arg
((
quint32
)
socketError
);
int
nrows
=
m_pMsgModel
Debug
->
rowCount
();
m_pMsgModel
Debug
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
16384
)
m_pMsgModel
Debug
->
removeRow
(
m_pMsgModelDebug
->
rowCount
()
-
1
);
int
nrows
=
m_pMsgModel
Cluster
->
rowCount
();
m_pMsgModel
Cluster
->
insertRow
(
0
,
new
QStandardItem
(
msg
));
while
(
nrows
--
>
4096
)
m_pMsgModel
Cluster
->
removeRow
(
m_pMsgModelCluster
->
rowCount
()
-
1
);
}
...
...
@@ -449,8 +422,13 @@ void ZPMainFrame::forkServer(const QString & config_file)
int
nClusterWorkingThreads
=
settings
.
value
(
"Cluster/nClusterWorkingThreads"
,
"4"
).
toInt
();
this
->
m_pClusterTerm
->
netEng
()
->
RemoveAllAddresses
();
this
->
m_pClusterTerm
->
netEng
()
->
RemoveClientTransThreads
(
-
1
,
false
);
this
->
m_pClusterTerm
->
netEng
()
->
AddClientTransThreads
(
nClusterTransThreads
,
false
);
this
->
m_pClusterTerm
->
taskEng
()
->
removeThreads
(
-
1
);
while
(
m_pClusterTerm
->
netEng
()
->
ListenerNames
().
size
())
{
QThread
::
currentThread
()
->
msleep
(
200
);
QCoreApplication
::
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
}
this
->
m_pClusterTerm
->
netEng
()
->
AddClientTransThreads
(
nClusterTransThreads
,
false
);
this
->
m_pClusterTerm
->
taskEng
()
->
addThreads
(
nClusterWorkingThreads
);
this
->
m_pClusterTerm
->
setName
(
strClusterPubName
);
this
->
m_pClusterTerm
->
setPublishAddr
(
QHostAddress
(
strClusterPubAddr
));
...
...
ZoomPipeline_FuncSvr/zpmainframe.h
浏览文件 @
95d3c5cb
...
...
@@ -22,13 +22,13 @@ public:
explicit
ZPMainFrame
(
QWidget
*
parent
=
0
);
~
ZPMainFrame
();
void
timerEvent
(
QTimerEvent
*
);
protected:
void
changeEvent
(
QEvent
*
e
);
QStandardItemModel
*
m_pMsgModel
;
QStandardItemModel
*
m_pMsgModel
Network
;
QStandardItemModel
*
m_pMsgModelCluster
;
QStandardItemModel
*
m_pMsgModelDatabase
;
QStandardItemModel
*
m_pMsgModelSmartlink
;
QStandardItemModel
*
m_pMsgModelDebug
;
//Config File Name
QString
m_currentConffile
;
//Listeners settings
...
...
@@ -57,7 +57,7 @@ private:
void
forkServer
(
const
QString
&
config_file
);
protected
slots
:
void
on_evt_Message
(
QObject
*
psource
,
const
QString
&
);
void
on_evt_Message
Network
(
QObject
*
psource
,
const
QString
&
);
//The socket error message
void
on_evt_SocketError
(
QObject
*
senderSock
,
QAbstractSocket
::
SocketError
socketError
);
void
on_evt_Message_Cluster
(
QObject
*
psource
,
const
QString
&
);
...
...
ZoomPipeline_FuncSvr/zpmainframe.ui
浏览文件 @
95d3c5cb
...
...
@@ -938,20 +938,6 @@
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"tab_msg_debug"
>
<attribute
name=
"icon"
>
<iconset
resource=
"resource.qrc"
>
<normaloff>
:/icons/Resources/BackUp-4.png
</normaloff>
:/icons/Resources/BackUp-4.png
</iconset>
</attribute>
<attribute
name=
"title"
>
<string>
Debug
</string>
</attribute>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_20"
>
<item>
<widget
class=
"QListView"
name=
"listView_msg_debug"
/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录