Revize 285c6fe5
Přidáno uživatelem Oto Šťáva před téměř 4 roky(ů)
deltarobot/curvedataserver.h | ||
---|---|---|
14 | 14 |
|
15 | 15 |
public: |
16 | 16 |
struct Client { |
17 |
/** |
|
18 |
* Size of the client buffer. |
|
19 |
* |
|
20 |
* @note Current implementation truncates any variable-length messages longer than what would fit in the buffer. |
|
21 |
*/ |
|
17 | 22 |
static const size_t BUF_SIZE = 4096; |
18 |
static const size_t MESSAGE_ID_SIZE = 2; |
|
23 |
|
|
24 |
static const size_t MESSAGE_ID_SIZE = sizeof(uint16_t); ///< Size of the protocol message identifier. |
|
25 |
static const size_t MESSAGE_LENGTH_SIZE = sizeof(uint32_t); ///< Size of the variable-length message's content length. |
|
19 | 26 |
|
20 | 27 |
QTcpSocket* socket; |
21 | 28 |
std::map<uint64_t, uint64_t> ping; ///< key: ping ID; value: ping timestamp (msec); |
... | ... | |
52 | 59 |
private: |
53 | 60 |
QList<Client>::iterator clientOf(QTcpSocket *socket); |
54 | 61 |
|
55 |
void handleMessage(Client& client, uint16_t messageId, void* content); |
|
62 |
void handleMessage(Client& client, uint16_t messageId, void* content, size_t contentSize);
|
|
56 | 63 |
void handleProtocolMagic(Client& client, char* content); |
57 | 64 |
void handleVersion(Client& client, uint8_t content); |
58 | 65 |
void handlePong(Client& client, uint64_t* content); |
59 |
void handleEOT(Client& client, char* content); |
|
66 |
void handleEOT(Client& client, char* content, size_t contentSize);
|
|
60 | 67 |
|
61 | 68 |
void validPreamble(Client& client); |
62 | 69 |
void removeSocket(QTcpSocket *socket); |
Také k dispozici: Unified diff
Re #8899 - Server - Implement variable-length message reception