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

Add some works for cross-svr-data trans

上级 be4ede43
......@@ -384,5 +384,27 @@ namespace SmartLink{
m_mutex_cross_svr_map.unlock();
emit evt_Message(this,tr("Removed remote %1 client uuid(s) from svr ").arg(nUUIDs) + svrname);
}
void st_client_table::cross_svr_send_data(const QString & svrname,const QByteArray & arr)
{
int nMsgLen = sizeof(STCROSSSVR_MSG::tag_msgHearder);
QByteArray array(nMsgLen,0);
STCROSSSVR_MSG * pMsg = (STCROSSSVR_MSG *) array.data();
pMsg->header.Mark = 0x4567;
pMsg->header.version = 1;
pMsg->header.messageLen = arr.size();
pMsg->header.mesageType = 0x03;
array.append(arr);
m_pCluster->SendDataToRemoteServer(svrname,array);
}
QString st_client_table::cross_svr_find_uuid(quint32 uuid)
{
QString svr = "";
m_mutex_cross_svr_map.lock();
if (m_hash_remoteClient2SvrName.find(uuid)!=m_hash_remoteClient2SvrName.end())
svr = m_hash_remoteClient2SvrName[uuid];
m_mutex_cross_svr_map.unlock();
return svr;
}
}
......@@ -52,6 +52,10 @@ namespace SmartLink{
void cross_svr_del_uuids(const QString & svrname,quint32 * pUUIDs , int nUUIDs);
//Tell remote servers of uuid-change
void broadcast_client_uuid(quint32 uuid, bool bActive);
//Trans user Data
void cross_svr_send_data(const QString & svrname,const QByteArray & arr);
//Server Name find
QString cross_svr_find_uuid(quint32 uuid);
protected:
//This list hold dead nodes that still in task queue,avoiding crash
......
......@@ -209,12 +209,14 @@ namespace SmartLink{
st_clientNode_baseTrans * destin_node = m_pClientTable->clientNodeFromUUID(m_currentHeader.destin_id);
if (destin_node==NULL)
{
//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(this,tr("Destin ID ") + QString("%1").arg(m_currentHeader.destin_id) + tr(" is not currently logged in."));
QString svr = m_pClientTable->cross_svr_find_uuid(m_currentHeader.destin_id);
if (svr.length()<=0)
emit evt_Message(this,tr("Destin ID ") + QString("%1").arg(m_currentHeader.destin_id) + tr(" is not currently logged in."));
else
m_pClientTable->cross_svr_send_data(svr,m_currentBlock);
//Do Nothing
}
else
{
......
......@@ -18,7 +18,7 @@ namespace SmartLink{
protected:
st_client_table * m_pClientTable;
//Current Message Offset, according to m_currentHeader
int m_currStMegSize;
quint32 m_currStMegSize;
//Current un-procssed message block.for large blocks,
//this array will be re-setted as soon as some part of data has been
//dealed, eg, send a 200MB block, the 200MB data will be splitted into pieces
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册