Skip to content

Commit

Permalink
Ack On Error - Wait missing fragments fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bartmoons committed Apr 13, 2023
1 parent 6ba511e commit 0031ed7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define COMPRESS 1 /* start fragmentation with or without compression first */
#define TRIGGER_PACKET_LOST 1
#define TRIGGER_MIC_CHECK 0
#define TRIGGER_CHANGE_MTU 1
#define TRIGGER_CHANGE_MTU 0

#define MAX_PACKET_LENGTH 256
#define MAX_TIMERS 256
Expand Down Expand Up @@ -362,7 +362,7 @@ int main() {

/* SCHC connection information */
tx_conn.fragmentation_rule = get_fragmentation_rule_by_reliability_mode(
ACK_ALWAYS, device_id);
ACK_ON_ERROR, device_id);
tx_conn.bit_arr = &bit_arr;

if (tx_conn.fragmentation_rule == NULL) {
Expand Down
24 changes: 12 additions & 12 deletions fragmenter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,14 +1244,8 @@ static uint8_t send_fragment(schc_fragmentation_t* conn, bool retransmission) {
DEBUG_PRINTF("\n");

if(!retransmission) {
/* store the tile sizes of the current window */
conn->window_tiles[conn->frag_cnt - 1] = packet_len;
DEBUG_PRINTF("send_fragment(): window tiles: ");

for (j = 0; j < MAX_WINDOW_SIZE; j++) {
DEBUG_PRINTF("%d ", conn->window_tiles[j]);
}
DEBUG_PRINTF("\n");

conn->total_tx_bits += packet_bits_tx;
}

Expand Down Expand Up @@ -1885,11 +1879,17 @@ int8_t schc_reassemble(schc_fragmentation_t* rx_conn) {
DEBUG_PRINTF("WAIT MISSING FRAGMENTS\n");
if (window == rx_conn->window) { // expected window
DEBUG_PRINTF("w == window\n");
if (fcn != 0 && fcn != get_max_fcn_value(rx_conn)
&& is_bitmap_full(rx_conn, rx_conn->fragmentation_rule->MAX_WND_FCN)) { // not all-x and bitmap not full
set_local_bitmap(rx_conn);
rx_conn->window = !rx_conn->window;
rx_conn->RX_STATE = RECV_WINDOW;
set_local_bitmap(rx_conn);
if (fcn != 0 && fcn != get_max_fcn_value(rx_conn)) {
if(is_bitmap_full(rx_conn, (rx_conn->fragmentation_rule->MAX_WND_FCN + 1))) { // not all-x and bitmap full
clear_bitmap(rx_conn);
rx_conn->window = !rx_conn->window;
rx_conn->window_cnt++;
rx_conn->RX_STATE = RECV_WINDOW;
}
else {

}
}
if (empty_all_0(tail, rx_conn)) {
rx_conn->RX_STATE = WAIT_MISSING_FRAG;
Expand Down

0 comments on commit 0031ed7

Please sign in to comment.