提交 569f27b8 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Add some method to auto-connect to other svrs.

上级 68559719
......@@ -587,21 +587,21 @@
<message>
<location filename="zpmainframe.ui" line="92"/>
<location filename="zpmainframe.ui" line="353"/>
<location filename="zpmainframe.cpp" line="116"/>
<location filename="zpmainframe.cpp" line="124"/>
<location filename="zpmainframe.cpp" line="119"/>
<location filename="zpmainframe.cpp" line="127"/>
<source>Name</source>
<translation>名称</translation>
</message>
<message>
<location filename="zpmainframe.ui" line="102"/>
<location filename="zpmainframe.cpp" line="117"/>
<location filename="zpmainframe.cpp" line="120"/>
<source>Addr</source>
<translation>地址</translation>
</message>
<message>
<location filename="zpmainframe.ui" line="112"/>
<location filename="zpmainframe.cpp" line="118"/>
<location filename="zpmainframe.cpp" line="127"/>
<location filename="zpmainframe.cpp" line="121"/>
<location filename="zpmainframe.cpp" line="130"/>
<source>Port</source>
<translation></translation>
</message>
......@@ -658,13 +658,13 @@
<message>
<location filename="zpmainframe.ui" line="342"/>
<location filename="zpmainframe.ui" line="905"/>
<location filename="zpmainframe.cpp" line="128"/>
<location filename="zpmainframe.cpp" line="131"/>
<source>Database</source>
<translation>数据库资源</translation>
</message>
<message>
<location filename="zpmainframe.ui" line="363"/>
<location filename="zpmainframe.cpp" line="125"/>
<location filename="zpmainframe.cpp" line="128"/>
<source>Type</source>
<translation>类型</translation>
</message>
......@@ -842,46 +842,46 @@
<translation>重新加载配置文件并调整服务器参数</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="119"/>
<location filename="zpmainframe.cpp" line="122"/>
<source>SSL</source>
<translation>SSL</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="126"/>
<location filename="zpmainframe.cpp" line="129"/>
<source>HostAddr</source>
<translation>服务地址</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="129"/>
<location filename="zpmainframe.cpp" line="132"/>
<source>Username</source>
<translation>用户名</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="130"/>
<location filename="zpmainframe.cpp" line="133"/>
<source>Options</source>
<translation>附加选项</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="131"/>
<location filename="zpmainframe.cpp" line="134"/>
<source>TestSQL</source>
<translation>用于测试连接的SQL</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="222"/>
<location filename="zpmainframe.cpp" line="225"/>
<source>Current Listen Threads: %1
</source>
<translation>监听端口: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="224"/>
<location filename="zpmainframe.cpp" line="227"/>
<source> Listen Threads %1: %2
</source>
<translation> 线程%1 监听 %2
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="227"/>
<location filename="zpmainframe.cpp" line="230"/>
<source>Current Trans Threads: %1
</source>
<translation>传输线程: %1
......@@ -904,176 +904,176 @@
<translation>有尚未主动退出的节点套接字是否继续等待?</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="146"/>
<location filename="zpmainframe.cpp" line="157"/>
<location filename="zpmainframe.cpp" line="168"/>
<location filename="zpmainframe.cpp" line="194"/>
<location filename="zpmainframe.cpp" line="149"/>
<location filename="zpmainframe.cpp" line="160"/>
<location filename="zpmainframe.cpp" line="171"/>
<location filename="zpmainframe.cpp" line="197"/>
<source>,Source=%1</source>
<translation>,来源:%1</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="230"/>
<location filename="zpmainframe.cpp" line="263"/>
<location filename="zpmainframe.cpp" line="233"/>
<location filename="zpmainframe.cpp" line="266"/>
<source> %1:%2</source>
<translation></translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="236"/>
<location filename="zpmainframe.cpp" line="239"/>
<source>Current Task Threads: %1
</source>
<translation>逻辑处理线程: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="237"/>
<location filename="zpmainframe.cpp" line="240"/>
<source>Current Task Payload: %1
</source>
<translation>逻辑处理负荷: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="238"/>
<location filename="zpmainframe.cpp" line="241"/>
<source>Current Task Idle Threads: %1
</source>
<translation>空闲逻辑处理线程:%1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="242"/>
<location filename="zpmainframe.cpp" line="245"/>
<source>Database Connections: %1
</source>
<translation>数据库连接: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="246"/>
<location filename="zpmainframe.cpp" line="249"/>
<source> %1 status = %2</source>
<translation> 连接 %1 状态 %2</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="253"/>
<location filename="zpmainframe.cpp" line="256"/>
<source>Cluster Group Paras:
</source>
<translation>集群终端参数:
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="254"/>
<location filename="zpmainframe.cpp" line="257"/>
<source> Terminal %1 : %2, published Address: %3:%4
</source>
<translation> 终端 %1 : %2, 发布地址: %3:%4
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="260"/>
<location filename="zpmainframe.cpp" line="263"/>
<source>Trans Threads: %1
</source>
<translation>传输线程: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="268"/>
<location filename="zpmainframe.cpp" line="271"/>
<source> Shift Threads: %1
</source>
<translation> 处理线程: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="269"/>
<location filename="zpmainframe.cpp" line="272"/>
<source> Shift Payload: %1
</source>
<translation> 处理线程负荷: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="270"/>
<location filename="zpmainframe.cpp" line="273"/>
<source> Shift Idle Threads: %1
</source>
<translation> 处理线程空闲: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="273"/>
<location filename="zpmainframe.cpp" line="276"/>
<source>Smartlink Function Server Paras:
</source>
<translation>Smartlink 功能服务器专有参数:
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="274"/>
<location filename="zpmainframe.cpp" line="277"/>
<source> User Account Database is : %1
</source>
<translation> 用户信息数据库: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="275"/>
<location filename="zpmainframe.cpp" line="278"/>
<source> Event Database is : %1
</source>
<translation> 重要事件数据库: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="276"/>
<location filename="zpmainframe.cpp" line="279"/>
<source> Local folder for large file is : %1
</source>
<translation> 磁盘仓库根路径: %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="277"/>
<location filename="zpmainframe.cpp" line="280"/>
<source> Heart beating Threadhold is : %1
</source>
<translation> 心跳保活门限 %1
</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="653"/>
<location filename="zpmainframe.cpp" line="658"/>
<source>Name Already Used.</source>
<translation>名称已经存在.</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="653"/>
<location filename="zpmainframe.cpp" line="658"/>
<source>The listener name has been used.</source>
<translation>监听器的名称已经被使用了</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="658"/>
<location filename="zpmainframe.cpp" line="663"/>
<source>Invalid Paraments.</source>
<translation>无效的参数.</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="658"/>
<location filename="zpmainframe.cpp" line="663"/>
<source>Address must be valid, Port between 1024 to 32767.</source>
<translation>监听端口需要介于 1024 32767之间</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="704"/>
<location filename="zpmainframe.cpp" line="709"/>
<source>Open Conf file</source>
<translation>打开配置文件</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="705"/>
<location filename="zpmainframe.cpp" line="710"/>
<source>Ini files(*.ini)</source>
<translation>Ini文件(*.ini)</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="719"/>
<location filename="zpmainframe.cpp" line="724"/>
<source>Name can&apos;t be empty.</source>
<translation>名称不能为空.</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="719"/>
<location filename="zpmainframe.cpp" line="724"/>
<source>Database name can not be empty.</source>
<translation>数据库资源名称不能为空</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="724"/>
<location filename="zpmainframe.cpp" line="729"/>
<source>Name already exist.</source>
<translation>名称已经被使用了</translation>
</message>
<message>
<location filename="zpmainframe.cpp" line="724"/>
<location filename="zpmainframe.cpp" line="729"/>
<source>Database name already exist.</source>
<translation>名称已经被使用了</translation>
</message>
......@@ -1115,7 +1115,7 @@
</message>
</context>
<context>
<name>ZPNetwork::zp_net_ThreadPool</name>
<name>ZPNetwork::zp_net_Engine</name>
<message>
<location filename="network/zp_net_threadpool.cpp" line="117"/>
<source>This ID has been used.</source>
......@@ -1142,4 +1142,32 @@
<translation>需要一些逻辑处理线程来处理具体的事件</translation>
</message>
</context>
<context>
<name>ZP_Cluster::zp_ClusterNode</name>
<message>
<location filename="cluster/zp_clusternode.cpp" line="160"/>
<source>Client Send a unknown start Header %1 %2. Close client immediately.</source>
<translation>客户发出了一个未知的开始头 %1 %2. 立刻关闭连接.</translation>
</message>
<message>
<location filename="cluster/zp_clusternode.cpp" line="192"/>
<source>Info: New Svr already regisited. Ignored.</source>
<translation>Info: 这个节点已经注册过了,忽略请求.</translation>
</message>
<message>
<location filename="cluster/zp_clusternode.cpp" line="200"/>
<source>Can not connect to it-self, Loopback connections is forbidden.</source>
<translation>请不要连接到自己的服务器节点. 回环连接是不被支持的.</translation>
</message>
<message>
<location filename="cluster/zp_clusternode.cpp" line="235"/>
<source>Client </source>
<translation>节点 </translation>
</message>
<message>
<location filename="cluster/zp_clusternode.cpp" line="235"/>
<source> is dead, kick out.</source>
<translation>丢失心跳终止该节点的连接</translation>
</message>
</context>
</TS>
......@@ -14,7 +14,7 @@ namespace ZP_Cluster{
connect(m_pClusterNet,&ZPNetwork::zp_net_Engine::evt_Data_transferred, this,&zp_ClusterTerm::on_evt_Data_transferred);
connect(m_pClusterNet,&ZPNetwork::zp_net_Engine::evt_ClientDisconnected, this,&zp_ClusterTerm::on_evt_ClientDisconnected);
connect(m_pClusterNet,&ZPNetwork::zp_net_Engine::evt_NewClientConnected, this,&zp_ClusterTerm::on_evt_NewClientConnected);
//connect(m_pClusterNet,&ZPNetwork::zp_net_ThreadPool::evt_ClientEncrypted, this,&zp_ClusterTerm::on_evt_ClientEncrypted);
//connect(m_pClusterNet,&ZPNetwork::zp_net_Engine::evt_ClientEncrypted, this,&zp_ClusterTerm::on_evt_ClientEncrypted);
m_nPortPublish = 0;
m_nHeartBeatingTime = 20;
......
......@@ -6,7 +6,7 @@ namespace ZPNetwork{
/**
* @brief Construct a net thread pool object.
*
* @fn zp_net_ThreadPool
* @fn zp_net_Engine
* @param nPayLoad The data to be sent in buffer will be cutted into pieces, each pieces equals to nPayLoad bytes
* @param parent a Qt-style parent pointer. this object will be auto-deleted when parent is about to be destoryed.
*/
......@@ -26,7 +26,7 @@ namespace ZPNetwork{
/**
* @brief return all of these listener names.
*
* @fn zp_net_ThreadPool::ListenerNames
* @fn zp_net_Engine::ListenerNames
* @return QStringList listener names.
*/
QStringList zp_net_Engine::ListenerNames()
......@@ -37,7 +37,7 @@ namespace ZPNetwork{
/**
* @brief Return how many threads is now actived for TCP transfer.
*
* @fn zp_net_ThreadPool::TransThreadNum
* @fn zp_net_Engine::TransThreadNum
* @return int 0 means no thread is active.
*/
int zp_net_Engine::TransThreadNum()
......@@ -47,7 +47,7 @@ namespace ZPNetwork{
/**
* @brief Return how many threads is now actived for SSL/Plain TCP transfer.
*
* @fn zp_net_ThreadPool::TransThreadNum
* @fn zp_net_Engine::TransThreadNum
* @param bSSL true means SSL Connection, false is Plain Connection
* @return int The transfer thread count for SSL connections.
*/
......@@ -68,7 +68,7 @@ namespace ZPNetwork{
/**
* @brief This function returns how many clients managed by idxThread is now online.
*
* @fn zp_net_ThreadPool::totalClients
* @fn zp_net_Engine::totalClients
* @param idxThread The thread index between 0 and TransThreadNum()-1
* @return int Clients which are currently online
*/
......@@ -84,7 +84,7 @@ namespace ZPNetwork{
/**
* @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.
* @fn zp_net_ThreadPool::AddListeningAddress
* @fn zp_net_Engine::AddListeningAddress
* @param id The name of this listening address:port. You can later using RemoveListeningAddress(id) to close it.
* @param address Listening address. IPV6 is now not tested.
* @param nPort Listening Port. in Linux, this value should larger than 1024.
......@@ -120,7 +120,7 @@ namespace ZPNetwork{
/**
* @brief Remove a listening socket at special address and port.The socket will be deactivated as soon as possible
*
* @fn zp_net_ThreadPool::RemoveListeningAddress
* @fn zp_net_Engine::RemoveListeningAddress
* @param id Listening-Address name specified by AddListeningAddress()
*/
void zp_net_Engine::RemoveListeningAddress(const QString & id)
......@@ -133,7 +133,7 @@ namespace ZPNetwork{
/**
* @brief Cancel all addresses.
*
* @fn zp_net_ThreadPool::RemoveAllAddresses
* @fn zp_net_Engine::RemoveAllAddresses
*/
void zp_net_Engine::RemoveAllAddresses()
{
......@@ -144,9 +144,9 @@ namespace ZPNetwork{
}
/**
* @brief This slot recieved incomming client socketDescriptor from listening threads.In this function, zp_net_ThreadPool
* @brief This slot recieved incomming client socketDescriptor from listening threads.In this function, zp_net_Engine
* will make a balance control, choosing a trans-thread which currently holds least clients than others.
* @fn zp_net_ThreadPool::on_New_Arrived_Client
* @fn zp_net_Engine::on_New_Arrived_Client
* @param socketDescriptor the socket descriptor for incomming client.
*/
void zp_net_Engine::on_New_Arrived_Client(qintptr socketDescriptor)
......@@ -195,7 +195,7 @@ namespace ZPNetwork{
/**
* @brief This is a slot function. when a listening thread is terminated,
* the thread itself will be deleted here. Some cleanning works is also needed.
* @fn zp_net_ThreadPool::on_ListenClosed
* @fn zp_net_Engine::on_ListenClosed
* @param id the terminated thread id.
*/
void zp_net_Engine::on_ListenClosed(const QString & id)
......@@ -226,7 +226,7 @@ namespace ZPNetwork{
/**
* @brief Add some threads to hold transfer between server and client.
* The send and recieve approaches are all managed by these threads, instead of main-GUI thread.
* @fn zp_net_ThreadPool::AddClientTransThreads
* @fn zp_net_Engine::AddClientTransThreads
* @param nThreads
* @param bSSL
*/
......@@ -267,7 +267,7 @@ namespace ZPNetwork{
/**
* @brief This slot will be called, when an Trans-thread is about to close.
* Some cleanning works will be done ,all resources will be freeed.
* @fn zp_net_ThreadPool::TransThreadDel
* @fn zp_net_Engine::TransThreadDel
* @param pThreadObj The closing thread object.
* @return bool in normal situation, this slot is always return true.
*/
......@@ -314,7 +314,7 @@ namespace ZPNetwork{
* @brief Kick all clients from server
* This Method is designed as an "Easy to compromise" method, which means this
* approach only "suggests" all these trans threads, that client should be kicked later.
* @fn zp_net_ThreadPool::KickAllClients
* @fn zp_net_Engine::KickAllClients
*/
void zp_net_Engine::KickAllClients()
{
......@@ -327,7 +327,7 @@ namespace ZPNetwork{
/**
* @brief :Deactive server immediately
* This Method is designed as an "Mandatory" method, which means all clients will be sooner kicked out.
* @fn zp_net_ThreadPool::DeactiveImmediately
* @fn zp_net_Engine::DeactiveImmediately
*/
void zp_net_Engine::DeactiveImmediately()
{
......@@ -341,7 +341,7 @@ namespace ZPNetwork{
/**
* @brief Remove n Trans Thread(s)
* A thread marked as "removed" will be terminated after its last client socket exited.
* @fn zp_net_ThreadPool::RemoveClientTransThreads
* @fn zp_net_Engine::RemoveClientTransThreads
* @param nThreads how many threads will be marked as "removed"
* @param bSSL true means SSL threads, false means Plain
*/
......@@ -370,7 +370,7 @@ namespace ZPNetwork{
* @brief This slot send some data to a client.
* Because a client socket is actually belongs to a transfer-thread,
* this event will be re-fired as evt_SendDataToClient, transfer-threads will
* @fn zp_net_ThreadPool::SendDataToClient
* @fn zp_net_Engine::SendDataToClient
* @param objClient The destin client
* @param dtarray data to be sent
*/
......@@ -381,7 +381,7 @@ namespace ZPNetwork{
/**
* @brief This slot kick client from server.
* @fn zp_net_ThreadPool::KickClients
* @fn zp_net_Engine::KickClients
* @param object Client to be kicked.
*/
void zp_net_Engine::KickClients(QObject * object)
......@@ -392,7 +392,7 @@ namespace ZPNetwork{
/**
* @brief Broadcast data to every client, except for the source object
*
* @fn zp_net_ThreadPool::BroadcastData
* @fn zp_net_Engine::BroadcastData
* @param objFromClient the source object.
* @param dtarray data to be sent.
*/
......@@ -405,7 +405,7 @@ namespace ZPNetwork{
/**
* @brief Test whether this threadpool can be safely closed.
* This function will return false as long as some clients is still active.
* @fn zp_net_ThreadPool::CanExit
* @fn zp_net_Engine::CanExit
* @return bool true means can close, false mean can not close.
*/
bool zp_net_Engine::CanExit()
......@@ -427,7 +427,7 @@ namespace ZPNetwork{
/**
* @brief Positive connect to a server.
* In p2p connection, when the other side opens a listening address, this object can directly connect to the remote side.
* @fn zp_net_ThreadPool::connectTo
* @fn zp_net_Engine::connectTo
* @param address the address to connect to
* @param nPort port to connect to
* @param bSSLConn if true, SSL connections will be used
......
......@@ -19,7 +19,7 @@
namespace ZPNetwork{
/**
* @brief zp_net_ThreadPool provides a multi-thread listening\transfer network
* @brief zp_net_Engine provides a multi-thread listening\transfer network
* framework. SSL and Plain sockets are both supported.
*/
class zp_net_Engine : public QObject
......
......@@ -12,12 +12,12 @@ namespace ZPNetwork{
}
/**
* @brief The slot recieves startListen command from its parent
* zp_net_ThreadPool object. the Qt's signal-and-slots system
* zp_net_Engine object. the Qt's signal-and-slots system
* likes a broadcast system, so, a string id should be used to
* tell each listening zp_netListenThread, only this id should be
* notified.
*
* @param id the Listening ID that zp_net_ThreadPool really
* @param id the Listening ID that zp_net_Engine really
* want to operate.
*/
void zp_netListenThread::startListen(const QString & id)
......@@ -44,7 +44,7 @@ namespace ZPNetwork{
/**
* @brief this method is very similar to zp_netListenThread::startListen(const QString & id)
*
* @param id the Listening ID that zp_net_ThreadPool really want to operate.
* @param id the Listening ID that zp_net_Engine really want to operate.
*/
void zp_netListenThread::stopListen(const QString & id)
{
......
......@@ -74,7 +74,7 @@ namespace ZPNetwork{
* @brief This slot dealing with multi-thread client socket accept.
* accepy works start from zp_netListenThread::m_tcpserver, end with this method.
* the socketDescriptor is delivered from zp_netListenThread(a Listening thread)
* to zp_net_ThreadPool(Normally in main-gui thread), and then zp_netTransThread.
* to zp_net_Engine(Normally in main-gui thread), and then zp_netTransThread.
*
* @param threadid if threadid is not equal to this object, this message is just omitted.
* @param socketDescriptor socketDescriptor for incomming client.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册