6767 #define MAX_UNSYNCED_POSTS 32
6868#endif
6969
70+ #ifndef SERVER_RESPONSE_DELAY
71+ #define SERVER_RESPONSE_DELAY 300
72+ #endif
73+
74+ #ifndef TXT_ACK_DELAY
75+ #define TXT_ACK_DELAY 200
76+ #endif
77+
7078#ifdef DISPLAY_CLASS
7179 #include " UITask.h"
7280 static UITask ui_task (display);
@@ -568,12 +576,12 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
568576 mesh::Packet* ack = createAck (ack_hash);
569577 if (ack) {
570578 if (client->out_path_len < 0 ) {
571- sendFlood (ack);
579+ sendFlood (ack, TXT_ACK_DELAY );
572580 } else {
573- sendDirect (ack, client->out_path , client->out_path_len );
581+ sendDirect (ack, client->out_path , client->out_path_len , TXT_ACK_DELAY );
574582 }
575583 }
576- delay_millis = REPLY_DELAY_MILLIS;
584+ delay_millis = TXT_ACK_DELAY + REPLY_DELAY_MILLIS;
577585 } else {
578586 delay_millis = 0 ;
579587 }
@@ -592,9 +600,9 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
592600 auto reply = createDatagram (PAYLOAD_TYPE_TXT_MSG, client->id , secret, temp, 5 + text_len);
593601 if (reply) {
594602 if (client->out_path_len < 0 ) {
595- sendFlood (reply, delay_millis);
603+ sendFlood (reply, delay_millis + SERVER_RESPONSE_DELAY );
596604 } else {
597- sendDirect (reply, client->out_path , client->out_path_len , delay_millis);
605+ sendDirect (reply, client->out_path , client->out_path_len , delay_millis + SERVER_RESPONSE_DELAY );
598606 }
599607 }
600608 }
@@ -637,7 +645,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
637645 auto reply = createAck (ack_hash);
638646 if (reply) {
639647 reply->payload [reply->payload_len ++] = getUnsyncedCount (client); // NEW: add unsynced counter to end of ACK packet
640- sendDirect (reply, client->out_path , client->out_path_len );
648+ sendDirect (reply, client->out_path , client->out_path_len , SERVER_RESPONSE_DELAY );
641649 }
642650 }
643651 } else {
@@ -647,14 +655,14 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
647655 // let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
648656 mesh::Packet* path = createPathReturn (client->id , secret, packet->path , packet->path_len ,
649657 PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
650- if (path) sendFlood (path);
658+ if (path) sendFlood (path, SERVER_RESPONSE_DELAY );
651659 } else {
652660 mesh::Packet* reply = createDatagram (PAYLOAD_TYPE_RESPONSE, client->id , secret, reply_data, reply_len);
653661 if (reply) {
654662 if (client->out_path_len >= 0 ) { // we have an out_path, so send DIRECT
655- sendDirect (reply, client->out_path , client->out_path_len );
663+ sendDirect (reply, client->out_path , client->out_path_len , SERVER_RESPONSE_DELAY );
656664 } else {
657- sendFlood (reply);
665+ sendFlood (reply, SERVER_RESPONSE_DELAY );
658666 }
659667 }
660668 }
0 commit comments