Revize 000564ed
Přidáno uživatelem Oto Šťáva před téměř 4 roky(ů)
deltarobot/curvedataserver.h | ||
---|---|---|
31 | 31 |
*/ |
32 | 32 |
static const size_t BUF_SIZE = 4096; |
33 | 33 |
|
34 |
static const size_t MESSAGE_ID_SIZE = sizeof(uint16_t); ///< Size of the protocol message identifier.
|
|
35 |
static const size_t MESSAGE_LENGTH_SIZE = sizeof(uint32_t); ///< Size of the variable-length message's content length.
|
|
34 |
static const size_t MESSAGE_ID_SIZE = sizeof(uint16_t); ///< Size of the protocol message identifier |
|
35 |
static const size_t MESSAGE_LENGTH_SIZE = sizeof(uint32_t); ///< Size of the variable-length message's content length |
|
36 | 36 |
|
37 | 37 |
QTcpSocket* socket; ///< Communication socket |
38 | 38 |
std::map<uint64_t, uint64_t> ping; ///< Key: ping ID; Value: ping timestamp (msec); |
... | ... | |
42 | 42 |
char buf[BUF_SIZE]; ///< Message buffer |
43 | 43 |
size_t bufUsed = 0; ///< Number of bytes used up in the message buffer |
44 | 44 |
|
45 |
bool magic = false; ///< Whether the client has sent the protocol magic |
|
46 |
bool version = false; ///< Whether the client has sent the protocol version |
|
47 |
bool initialized = false; ///< Whether the client has successfully initialized its communication (by sending its magic and version) |
|
45 |
bool magic = false; ///< Whether the client has sent the correct protocol magic |
|
46 |
bool version = false; ///< Whether the client has sent the correct protocol version |
|
47 |
bool protocolValid = false; ///< Whether the client has sent both the correct protocol magic and version. |
|
48 |
|
|
49 |
bool initialized = false; ///< Whether the server has initialized this client with the current curve |
|
48 | 50 |
|
49 | 51 |
Client(QTcpSocket* socket); |
50 | 52 |
}; |
... | ... | |
88 | 90 |
void handlePong(Client& client, uint64_t* content); |
89 | 91 |
void handleEOT(Client& client, char* content, size_t contentSize); |
90 | 92 |
|
93 |
/** |
|
94 |
* Checks whether the specified client has already sent both its protocol magic and version. If so, the appropriate |
|
95 |
* flag is set and a log is written out into qDebug. |
|
96 |
*/ |
|
97 |
void validateProtocol(Client& client); |
|
98 |
|
|
91 | 99 |
void removeSocket(QTcpSocket *socket); |
92 | 100 |
void terminateConnection(Client& client, std::string&& reason); |
93 | 101 |
void sendPing(Client& client); |
Také k dispozici: Unified diff
Re #8906 - Server - Add messages for incoming connections