Skip to content

Commit

Permalink
avoid resending async ack packet if sync acked
Browse files Browse the repository at this point in the history
  • Loading branch information
gioblu committed Mar 31, 2017
1 parent b44a295 commit 0bfb888
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions PJON.h
Expand Up @@ -887,16 +887,19 @@ limitations under the License. */


bool async_ack = (packets[i].content[1] & PJON_ACK_MODE_BIT) && bool async_ack = (packets[i].content[1] & PJON_ACK_MODE_BIT) &&
(packets[i].content[1] & PJON_TX_INFO_BIT); (packets[i].content[1] & PJON_TX_INFO_BIT);
bool sync_ack = (packets[i].content[1] & PJON_ACK_REQ_BIT);


if( if(
(uint32_t)(PJON_MICROS() - packets[i].registration) > (uint32_t)(PJON_MICROS() - packets[i].registration) >
(uint32_t)( (uint32_t)(
packets[i].timing + packets[i].timing +
strategy.back_off(packets[i].attempts) strategy.back_off(packets[i].attempts)
) )
) packets[i].state = ) {
send_packet(packets[i].content, packets[i].length); if(!(sync_ack && async_ack && packets[i].state == PJON_ACK))
else continue; packets[i].state = // Avoid resending sync-acked async ack packets
send_packet(packets[i].content, packets[i].length);
} else continue;


packets[i].attempts++; packets[i].attempts++;


Expand Down

0 comments on commit 0bfb888

Please sign in to comment.