Skip to content

Commit 5d15a68

Browse files
author
Scott Powell
committed
* SERVER_RESPONSE_DELAY now applied to: login responses, companion telemetry responses
1 parent 0535919 commit 5d15a68

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

examples/simple_repeater/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,14 +383,14 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
383383
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
384384
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
385385
PAYLOAD_TYPE_RESPONSE, reply_data, 12);
386-
if (path) sendFlood(path);
386+
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
387387
} else {
388388
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 12);
389389
if (reply) {
390390
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
391-
sendDirect(reply, client->out_path, client->out_path_len);
391+
sendDirect(reply, client->out_path, client->out_path_len, SERVER_RESPONSE_DELAY);
392392
} else {
393-
sendFlood(reply);
393+
sendFlood(reply, SERVER_RESPONSE_DELAY);
394394
}
395395
}
396396
}

examples/simple_room_server/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,14 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
479479
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
480480
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
481481
PAYLOAD_TYPE_RESPONSE, reply_data, 8 + 2);
482-
if (path) sendFlood(path);
482+
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
483483
} else {
484484
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 8 + 2);
485485
if (reply) {
486486
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
487-
sendDirect(reply, client->out_path, client->out_path_len);
487+
sendDirect(reply, client->out_path, client->out_path_len, SERVER_RESPONSE_DELAY);
488488
} else {
489-
sendFlood(reply);
489+
sendFlood(reply, SERVER_RESPONSE_DELAY);
490490
}
491491
}
492492
}

src/helpers/BaseChatMesh.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <helpers/BaseChatMesh.h>
22
#include <Utils.h>
33

4+
#ifndef SERVER_RESPONSE_DELAY
5+
#define SERVER_RESPONSE_DELAY 300
6+
#endif
7+
48
#ifndef TXT_ACK_DELAY
59
#define TXT_ACK_DELAY 200
610
#endif
@@ -191,14 +195,14 @@ void BaseChatMesh::onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender
191195
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
192196
mesh::Packet* path = createPathReturn(from.id, secret, packet->path, packet->path_len,
193197
PAYLOAD_TYPE_RESPONSE, temp_buf, reply_len);
194-
if (path) sendFlood(path);
198+
if (path) sendFlood(path, SERVER_RESPONSE_DELAY);
195199
} else {
196200
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, from.id, secret, temp_buf, reply_len);
197201
if (reply) {
198202
if (from.out_path_len >= 0) { // we have an out_path, so send DIRECT
199-
sendDirect(reply, from.out_path, from.out_path_len);
203+
sendDirect(reply, from.out_path, from.out_path_len, SERVER_RESPONSE_DELAY);
200204
} else {
201-
sendFlood(reply);
205+
sendFlood(reply, SERVER_RESPONSE_DELAY);
202206
}
203207
}
204208
}

0 commit comments

Comments
 (0)