Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
蚂蚁寻路
zoompipeline
提交
99fb36cb
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,体验更适合开发者的 AI 搜索 >>
提交
99fb36cb
编写于
4月 28, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cross-Svr Connections Finished
上级
b4b0a896
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
81 addition
and
18 deletion
+81
-18
ZoomPipeline_FuncSvr/cluster/zp_clusternode.cpp
ZoomPipeline_FuncSvr/cluster/zp_clusternode.cpp
+6
-2
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
+40
-5
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
+3
-1
ZoomPipeline_FuncSvr/dialogaddressinput.ui
ZoomPipeline_FuncSvr/dialogaddressinput.ui
+3
-3
ZoomPipeline_FuncSvr/zpmainframe.cpp
ZoomPipeline_FuncSvr/zpmainframe.cpp
+23
-0
ZoomPipeline_FuncSvr/zpmainframe.h
ZoomPipeline_FuncSvr/zpmainframe.h
+2
-0
ZoomPipeline_FuncSvr/zpmainframe.ui
ZoomPipeline_FuncSvr/zpmainframe.ui
+4
-7
未找到文件。
ZoomPipeline_FuncSvr/cluster/zp_clusternode.cpp
浏览文件 @
99fb36cb
...
...
@@ -219,7 +219,7 @@ namespace ZP_Cluster{
m_addrPublish
=
QHostAddress
((
const
char
*
)
pMsg
->
payload
.
basicInfo
.
Address
);
if
(
false
==
m_pTerm
->
regisitNewServer
(
this
))
{
emit
evt_Message
(
this
,
tr
(
"Info: New Svr already regisited. Ignored."
));
emit
evt_Message
(
this
,
tr
(
"Info: New Svr already regisited. Ignored."
)
+
strName
);
emit
evt_close_client
(
this
->
sock
());
}
//else
...
...
@@ -243,8 +243,12 @@ namespace ZP_Cluster{
{
QHostAddress
addrToConnectTo
((
const
char
*
)
pMsg
->
payload
.
broadcastMsg
[
i
].
Address
);
quint16
PortToConnectTo
=
pMsg
->
payload
.
broadcastMsg
[
i
].
port
;
//because cross-connection is not good, we just want the low Addr:port connect to max Addr:Port.
//Connect to New Servers
emit
evt_connect_to
(
addrToConnectTo
,
PortToConnectTo
,
false
);
if
(
strName
>
m_pTerm
->
name
())
emit
evt_connect_to
(
addrToConnectTo
,
PortToConnectTo
,
false
);
else
emit
evt_Message
(
this
,
tr
(
"Name %1 <= %2, omitted."
).
arg
(
strName
).
arg
(
m_pTerm
->
name
()));
}
}
}
...
...
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.cpp
浏览文件 @
99fb36cb
...
...
@@ -72,12 +72,47 @@ namespace ZP_Cluster{
{
return
m_pClusterEng
->
canClose
()
&&
m_pClusterNet
->
CanExit
();
}
QStringList
zp_ClusterTerm
::
SvrNames
()
{
QStringList
lst
;
m_hash_mutex
.
lock
();
QList
<
QString
>
keys
=
m_hash_Name2node
.
keys
();
//Msgs
foreach
(
QString
key
,
keys
)
{
lst
.
push_back
(
m_hash_Name2node
[
key
]
->
termName
());
}
m_hash_mutex
.
unlock
();
return
lst
;
}
QHostAddress
zp_ClusterTerm
::
SvrAddr
(
const
QString
&
name
)
{
QHostAddress
addr
;
m_hash_mutex
.
lock
();
if
(
m_hash_Name2node
.
contains
(
name
))
addr
=
m_hash_Name2node
[
name
]
->
addrPublish
();
m_hash_mutex
.
unlock
();
return
addr
;
}
int
zp_ClusterTerm
::
SvrPort
(
const
QString
&
name
)
{
int
port
=
0
;
m_hash_mutex
.
lock
();
if
(
m_hash_Name2node
.
contains
(
name
))
port
=
m_hash_Name2node
[
name
]
->
portPublish
();
m_hash_mutex
.
unlock
();
return
port
;
}
bool
zp_ClusterTerm
::
regisitNewServer
(
zp_ClusterNode
*
c
)
{
//Before reg, termname must be recieved.
if
(
c
->
termName
().
length
()
<
1
)
{
emit
evt_Message
(
c
,
tr
(
"Name is empty!"
)
+
c
->
termName
());
return
false
;
}
m_hash_mutex
.
lock
();
if
(
m_hash_Name2node
.
contains
(
c
->
termName
())
==
true
)
{
...
...
@@ -185,16 +220,16 @@ namespace ZP_Cluster{
pClientNode
=
m_hash_sock2node
[
clientHandle
];
if
(
pClientNode
)
{
m_hash_sock2node
.
remove
(
clientHandle
);
if
(
pClientNode
->
termName
().
length
()
>
0
)
m_hash_Name2node
.
remove
(
pClientNode
->
termName
());
pClientNode
->
bTermSet
=
true
;
disconnect
(
pClientNode
,
&
zp_ClusterNode
::
evt_SendDataToClient
,
m_pClusterNet
,
&
ZPNetwork
::
zp_net_Engine
::
SendDataToClient
);
disconnect
(
pClientNode
,
&
zp_ClusterNode
::
evt_BroadcastData
,
m_pClusterNet
,
&
ZPNetwork
::
zp_net_Engine
::
evt_BroadcastData
);
disconnect
(
pClientNode
,
&
zp_ClusterNode
::
evt_close_client
,
m_pClusterNet
,
&
ZPNetwork
::
zp_net_Engine
::
KickClients
);
disconnect
(
pClientNode
,
&
zp_ClusterNode
::
evt_Message
,
this
,
&
zp_ClusterTerm
::
evt_Message
);
disconnect
(
pClientNode
,
&
zp_ClusterNode
::
evt_connect_to
,
m_pClusterNet
,
&
ZPNetwork
::
zp_net_Engine
::
connectTo
);
m_hash_sock2node
.
remove
(
clientHandle
);
if
(
pClientNode
->
termName
().
length
()
>
0
)
m_hash_Name2node
.
remove
(
pClientNode
->
termName
());
pClientNode
->
bTermSet
=
true
;
m_nodeToBeDel
.
push_back
(
pClientNode
);
//qDebug()<<QString("%1(ref %2) Node Push in queue.\n").arg((unsigned int)pClientNode).arg(pClientNode->ref());
}
...
...
ZoomPipeline_FuncSvr/cluster/zp_clusterterm.h
浏览文件 @
99fb36cb
...
...
@@ -53,7 +53,9 @@ namespace ZP_Cluster{
public:
zp_ClusterNode
*
SvrNodeFromName
(
const
QString
&
);
zp_ClusterNode
*
SvrNodeFromSocket
(
QObject
*
);
QStringList
SvrNames
();
QHostAddress
SvrAddr
(
const
QString
&
name
);
int
SvrPort
(
const
QString
&
name
);
signals:
void
evt_Message
(
QObject
*
,
const
QString
&
);
...
...
ZoomPipeline_FuncSvr/dialogaddressinput.ui
浏览文件 @
99fb36cb
...
...
@@ -6,12 +6,12 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
1
7
4
</width>
<height>
97
</height>
<width>
1
8
4
</width>
<height>
106
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Dialog
</string>
<string>
Participate in CLUSTER
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
...
...
ZoomPipeline_FuncSvr/zpmainframe.cpp
浏览文件 @
99fb36cb
...
...
@@ -140,6 +140,12 @@ void ZPMainFrame::initUI()
pCombo
->
appendRow
(
new
QStandardItem
(
str
));
}
ui
->
comboBox_db_type
->
setModel
(
pCombo
);
m_pModelCluster
=
new
QStandardItemModel
(
0
,
3
,
this
);
m_pModelCluster
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
tr
(
"Name"
));
m_pModelCluster
->
setHeaderData
(
1
,
Qt
::
Horizontal
,
tr
(
"Address"
));
m_pModelCluster
->
setHeaderData
(
2
,
Qt
::
Horizontal
,
tr
(
"Port"
));
ui
->
tableView_activeTerms
->
setModel
(
m_pModelCluster
);
}
void
ZPMainFrame
::
on_evt_MessageNetwork
(
QObject
*
psource
,
const
QString
&
strMsg
)
...
...
@@ -280,6 +286,23 @@ void ZPMainFrame::timerEvent(QTimerEvent * e)
str_msg
+=
tr
(
"
\t
Heart beating Threadhold is : %1
\n
"
).
arg
(
m_clientTable
->
heartBeatingThrd
());
ui
->
plainTextEdit_status_net
->
setPlainText
(
str_msg
);
//The Cluster Info
QStringList
lstCluster
=
m_pClusterTerm
->
SvrNames
();
m_pModelCluster
->
removeRows
(
0
,
m_pModelCluster
->
rowCount
());
int
nInserted
=
0
;
foreach
(
QString
strNodeName
,
lstCluster
)
{
m_pModelCluster
->
insertRow
(
nInserted
);
m_pModelCluster
->
setData
(
m_pModelCluster
->
index
(
nInserted
,
0
),
strNodeName
);
m_pModelCluster
->
setData
(
m_pModelCluster
->
index
(
nInserted
,
1
),
m_pClusterTerm
->
SvrAddr
(
strNodeName
).
toString
());
m_pModelCluster
->
setData
(
m_pModelCluster
->
index
(
nInserted
,
2
),
m_pClusterTerm
->
SvrPort
(
strNodeName
));
++
nInserted
;
}
nInserted
++
;
}
else
if
(
e
->
timerId
()
==
m_nTimerCheck
)
{
...
...
ZoomPipeline_FuncSvr/zpmainframe.h
浏览文件 @
99fb36cb
...
...
@@ -41,6 +41,8 @@ protected:
//Dead check
int
m_nTimerCheck
;
QStandardItemModel
*
m_pModelCluster
;
private:
...
...
ZoomPipeline_FuncSvr/zpmainframe.ui
浏览文件 @
99fb36cb
...
...
@@ -623,12 +623,9 @@
</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>
<widget
class=
"QTableView"
name=
"tableView_activeTerms"
>
<property
name=
"alternatingRowColors"
>
<bool>
true
</bool>
</property>
</widget>
</item>
...
...
@@ -952,7 +949,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
640
</width>
<height>
2
3
</height>
<height>
2
1
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menu_Control"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录