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

Prepare for function develop.

上级 66134ea4
......@@ -21,7 +21,7 @@ public:
protected:
QList<st_clientNode *> m_nodeToBeDel;
QMutex m_hash_mutex;
QMap<QString,st_clientNode *> m_hash_uuid2node;
QMap<quint32,st_clientNode *> m_hash_uuid2node;
QMap<QObject *,st_clientNode *> m_hash_sock2node;
ZPNetwork::zp_net_ThreadPool * m_pThreadPool;
ZPTaskEngine::zp_pipeline * m_pTaskEngine;
......
......@@ -5,8 +5,9 @@ st_clientNode::st_clientNode(st_client_table * pClientTable, QObject * pClientSo
zp_plTaskBase(parent)
{
m_bUUIDRecieved = false;
m_currentRed = 0;
m_pClientSock = pClientSock;
m_uuid = "";
m_uuid = 0xffffffff;//Not Valid
m_pClientTable = pClientTable;
bTermSet = false;
}
......@@ -26,11 +27,10 @@ int st_clientNode::run()
QByteArray block;
m_mutex.lock();
//Limit max pending blocks.if blocks too long, memory will be low
while (m_list_RawData.size()>=256)
m_list_RawData.pop_front();
//while (m_list_RawData.size()>=16)
// m_list_RawData.pop_front();
if (m_list_RawData.size())
{
block = *m_list_RawData.begin();
m_list_RawData.pop_front();
}
......
......@@ -26,7 +26,7 @@ public:
//push new binary data into queue
int push_new_data(const QByteArray & dtarray);
const QString & uuid(){return m_uuid;}
quint32 uuid(){return m_uuid;}
QObject * sock() {return m_pClientSock;}
bool bTermSet;
......@@ -35,12 +35,14 @@ public:
//data items
protected:
//The current Read Offset
int m_currentRed;
//The raw data queue and its mutex
QList<QByteArray> m_list_RawData;
QMutex m_mutex;
//UUID of this equipment
bool m_bUUIDRecieved;
QString m_uuid;
quint32 m_uuid; //Client ID
//Client socket handle of this connection
QObject * m_pClientSock;
......
......@@ -3,14 +3,33 @@
#pragma pack (push,1)
#define SMARTLINK_UUID_LEN 24
#if defined(__GNUC__)
typedef struct tag_smartlink_message{
unsigned char Mark[2]; //Always be "S" and "T" in upper case
unsigned int32_t version; //Structure Version
unsigned int32_t source_id ; //0xffffffff means from server
unsigned int32_t destin_id ; //0xffffffff means to server
struct tag_payload{
unsigned int32_t data_length; //Data at least have 2 byte, for heart-beating counter.
unsigned int8_t data[2];
} payload;
} SMARTLINK_MSG;
#endif
#if defined(_MSC_VER)
typedef struct tag_smartlink_message{
unsigned char uuid_from [SMARTLINK_UUID_LEN];
unsigned char uuid_to [SMARTLINK_UUID_LEN];
unsigned char message_size[2]; // an Int-16 size of this message block,message_size[0] is low 8 bits, 1 is height 8 bits
unsigned char message_block[1];// an message-Block array, have message_size items.
} SMARTLINK_MSG;
unsigned char Mark[2]; //Always be "S" and "T" in upper case
unsigned __int32 version; //Structure Version
unsigned __int32 source_id ; //0xffffffff means from server
unsigned __int32 destin_id ; //0xffffffff means to server
struct tag_payload{
unsigned __int32 data_length; //Data at least have 2 byte, for heart-beating counter.
unsigned __int8 data[2];
} payload;
} SMARTLINK_MSG;
#endif
#pragma pack(pop)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册