Skip to content

Commit 8cf20c7

Browse files
author
Scott Powell
committed
* Room server fix: re-tries for pushPostToClient() used to have same packet hash
1 parent 1ba69f3 commit 8cf20c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/simple_room_server/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
204204
void pushPostToClient(ClientInfo* client, PostInfo& post) {
205205
int len = 0;
206206
memcpy(&reply_data[len], &post.post_timestamp, 4); len += 4; // this is a PAST timestamp... but should be accepted by client
207-
reply_data[len++] = (TXT_TYPE_SIGNED_PLAIN << 2); // 'signed' plain text
207+
208+
uint8_t attempt;
209+
getRNG()->random(&attempt, 1); // need this for re-tries, so packet hash (and ACK) will be different
210+
reply_data[len++] = (TXT_TYPE_SIGNED_PLAIN << 2) | (attempt & 3); // 'signed' plain text
208211

209212
// encode prefix of post.author.pub_key
210213
memcpy(&reply_data[len], post.author.pub_key, 4); len += 4; // just first 4 bytes

0 commit comments

Comments
 (0)