Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_45630965
zoompipeline
提交
aca13f1d
zoompipeline
项目概览
weixin_45630965
/
zoompipeline
与 Fork 源项目一致
Fork自
colorEagleStdio / zoompipeline
通知
1
Star
0
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,体验更适合开发者的 AI 搜索 >>
提交
aca13f1d
编写于
1月 25, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add dead client kicked out method. clients who lost heart-beating will be kicked in minutes
上级
94722e9d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
43 deletion
+70
-43
ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp
ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp
+46
-37
ZoomPipeline_FuncSvr/smartlink/st_client_table.h
ZoomPipeline_FuncSvr/smartlink/st_client_table.h
+1
-1
ZoomPipeline_FuncSvr/smartlink/st_clientnode.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode.cpp
+12
-1
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
+1
-1
ZoomPipeline_FuncSvr/zpmainframe.cpp
ZoomPipeline_FuncSvr/zpmainframe.cpp
+6
-1
ZoomPipeline_FuncSvr/zpmainframe.h
ZoomPipeline_FuncSvr/zpmainframe.h
+4
-2
未找到文件。
ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp
浏览文件 @
aca13f1d
...
...
@@ -13,45 +13,54 @@ st_client_table::st_client_table(ZPNetwork::zp_net_ThreadPool * pool, ZPTaskEngi
connect
(
m_pThreadPool
,
&
ZPNetwork
::
zp_net_ThreadPool
::
evt_Data_recieved
,
this
,
&
st_client_table
::
on_evt_Data_recieved
,
Qt
::
QueuedConnection
);
connect
(
m_pThreadPool
,
&
ZPNetwork
::
zp_net_ThreadPool
::
evt_Data_transferred
,
this
,
&
st_client_table
::
on_evt_Data_transferred
,
Qt
::
QueuedConnection
);
}
st_client_table
::~
st_client_table
()
st_client_table
::~
st_client_table
()
{
}
void
st_client_table
::
KickDealClients
()
{
m_hash_mutex
.
lock
();
for
(
QMap
<
QObject
*
,
st_clientNode
*>::
iterator
p
=
m_hash_sock2node
.
begin
();
p
!=
m_hash_sock2node
.
end
();
p
++
)
{
p
.
value
()
->
CheckHeartBeating
();
}
m_hash_mutex
.
unlock
();
}
bool
st_client_table
::
regisitClientUUID
(
st_clientNode
*
c
)
{
if
(
c
->
uuidValid
()
==
false
)
return
false
;
m_hash_mutex
.
lock
();
m_hash_uuid2node
[
c
->
uuid
()]
=
c
;
m_hash_mutex
.
unlock
();
return
true
;
}
bool
st_client_table
::
regisitClientUUID
(
st_clientNode
*
c
)
{
if
(
c
->
uuidValid
()
==
false
)
return
false
;
m_hash_mutex
.
lock
();
m_hash_uuid2node
[
c
->
uuid
()]
=
c
;
m_hash_mutex
.
unlock
();
return
true
;
}
st_clientNode
*
st_client_table
::
clientNodeFromUUID
(
quint32
uuid
)
{
m_hash_mutex
.
lock
();
if
(
m_hash_uuid2node
.
contains
(
uuid
))
{
m_hash_mutex
.
unlock
();
return
m_hash_uuid2node
[
uuid
];
}
m_hash_mutex
.
unlock
();
return
NULL
;
}
st_clientNode
*
st_client_table
::
clientNodeFromSocket
(
QObject
*
sock
)
{
m_hash_mutex
.
lock
();
if
(
m_hash_sock2node
.
contains
(
sock
))
{
m_hash_mutex
.
unlock
();
return
m_hash_sock2node
[
sock
];
}
m_hash_mutex
.
unlock
();
return
NULL
;
}
st_clientNode
*
st_client_table
::
clientNodeFromUUID
(
quint32
uuid
)
{
m_hash_mutex
.
lock
();
if
(
m_hash_uuid2node
.
contains
(
uuid
))
{
m_hash_mutex
.
unlock
();
return
m_hash_uuid2node
[
uuid
];
}
m_hash_mutex
.
unlock
();
return
NULL
;
}
st_clientNode
*
st_client_table
::
clientNodeFromSocket
(
QObject
*
sock
)
{
m_hash_mutex
.
lock
();
if
(
m_hash_sock2node
.
contains
(
sock
))
{
m_hash_mutex
.
unlock
();
return
m_hash_sock2node
[
sock
];
}
m_hash_mutex
.
unlock
();
return
NULL
;
}
//this event indicates new client connected.
...
...
@@ -94,7 +103,7 @@ void st_client_table::on_evt_ClientDisconnected(QObject * clientHandle)
toBedel
.
push_back
(
pdelobj
);
else
{
//qDebug()<<QString("%1(ref %2) Waiting in del queue.\n").arg((unsigned int)pdelobj).arg(pdelobj->ref());
//qDebug()<<QString("%1(ref %2) Waiting in del queue.\n").arg((unsigned int)pdelobj).arg(pdelobj->ref());
}
}
foreach
(
st_clientNode
*
pdelobj
,
toBedel
)
...
...
ZoomPipeline_FuncSvr/smartlink/st_client_table.h
浏览文件 @
aca13f1d
...
...
@@ -20,7 +20,7 @@ public:
bool
regisitClientUUID
(
st_clientNode
*
);
st_clientNode
*
clientNodeFromUUID
(
quint32
);
st_clientNode
*
clientNodeFromSocket
(
QObject
*
);
void
KickDealClients
();
protected:
QList
<
st_clientNode
*>
m_nodeToBeDel
;
QMutex
m_hash_mutex
;
...
...
ZoomPipeline_FuncSvr/smartlink/st_clientnode.cpp
浏览文件 @
aca13f1d
...
...
@@ -253,7 +253,7 @@ int st_clientNode::deal_current_message_block()
//need further dev, insert into db, or catched on disk.
//destin client is un-reachable, or in another function server.
//need server-to-server channels to re-post this message.
emit
evt_Message
(
tr
(
"Destin ID "
)
+
QString
(
"%1"
).
arg
(
m_currentHeader
.
destin_id
)
+
tr
(
" is not currently logged in.
\n
"
));
emit
evt_Message
(
tr
(
"Destin ID "
)
+
QString
(
"%1"
).
arg
(
m_currentHeader
.
destin_id
)
+
tr
(
" is not currently logged in."
));
//Do Nothing
}
...
...
@@ -266,4 +266,15 @@ int st_clientNode::deal_current_message_block()
}
return
0
;
}
void
st_clientNode
::
CheckHeartBeating
()
{
QDateTime
dtm
=
QDateTime
::
currentDateTime
();
qint64
usc
=
this
->
m_last_Report
.
secsTo
(
dtm
);
if
(
usc
>=
60
)
{
emit
evt_Message
(
tr
(
"Client "
)
+
QString
(
"%1"
).
arg
((
unsigned
int
)(
this
))
+
tr
(
" is dead, kick out."
));
emit
evt_close_client
(
this
->
sock
());
}
}
}
ZoomPipeline_FuncSvr/smartlink/st_clientnode.h
浏览文件 @
aca13f1d
...
...
@@ -34,7 +34,7 @@ public:
{
return
m_last_Report
;
}
void
CheckHeartBeating
();
protected:
//!deal one message, affect m_currentRedOffset,m_currentMessageSize,m_currentHeader
//!return bytes Used.
...
...
ZoomPipeline_FuncSvr/zpmainframe.cpp
浏览文件 @
aca13f1d
...
...
@@ -31,7 +31,7 @@ ZPMainFrame::ZPMainFrame(QWidget *parent) :
m_pDatabases
->
start
();
m_nTimerId
=
startTimer
(
500
);
m_nTimerCheck
=
startTimer
(
10000
);
initUI
();
LoadSettings
(
m_currentConffile
);
}
...
...
@@ -163,6 +163,11 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
ui
->
plainTextEdit_status_net
->
setPlainText
(
str_msg
);
}
else
if
(
e
->
timerId
()
==
m_nTimerCheck
)
{
m_clientTable
->
KickDealClients
();
}
}
void
ZPMainFrame
::
on_action_Start_Stop_triggered
(
bool
setordel
)
{
...
...
ZoomPipeline_FuncSvr/zpmainframe.h
浏览文件 @
aca13f1d
...
...
@@ -20,10 +20,9 @@ class ZPMainFrame : public QMainWindow
public:
explicit
ZPMainFrame
(
QWidget
*
parent
=
0
);
~
ZPMainFrame
();
void
timerEvent
(
QTimerEvent
*
);
protected:
void
changeEvent
(
QEvent
*
e
);
void
timerEvent
(
QTimerEvent
*
);
QStandardItemModel
*
m_pMsgModel
;
//Config File Name
...
...
@@ -35,6 +34,9 @@ protected:
QStandardItemModel
*
m_pDbResModel
;
QMap
<
QString
,
QString
>
m_set_DbResNames
;
//Dead check
int
m_nTimerCheck
;
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录