Permalink
Browse files

avoid resending async ack packet if sync acked

  • Loading branch information...
gioblu committed Mar 31, 2017
1 parent b44a295 commit 0bfb8889e84aa8bb07a877aef73e382ce7a2d9fe
Showing with 6 additions and 3 deletions.
  1. +6 −3 PJON.h
9 PJON.h
@@ -887,16 +887,19 @@ limitations under the License. */
bool async_ack = (packets[i].content[1] & PJON_ACK_MODE_BIT) &&
(packets[i].content[1] & PJON_TX_INFO_BIT);
bool sync_ack = (packets[i].content[1] & PJON_ACK_REQ_BIT);
if(
(uint32_t)(PJON_MICROS() - packets[i].registration) >
(uint32_t)(
packets[i].timing +
strategy.back_off(packets[i].attempts)
)
) packets[i].state =
send_packet(packets[i].content, packets[i].length);
else continue;
) {
if(!(sync_ack && async_ack && packets[i].state == PJON_ACK))
packets[i].state = // Avoid resending sync-acked async ack packets
send_packet(packets[i].content, packets[i].length);
} else continue;
packets[i].attempts++;

0 comments on commit 0bfb888

Please sign in to comment.