mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Fix some issues with DATA ACK
This commit is contained in:
parent
09a0a0946e
commit
8914ac5f0b
3 changed files with 11 additions and 13 deletions
|
@ -773,6 +773,6 @@ CHIAKI_EXPORT ChiakiErrorCode stream_connection_send_corrupt_frame(ChiakiStreamC
|
|||
return CHIAKI_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
CHIAKI_LOGD(stream_connection->log, "StreamConnection reporting corrupt frame(s) from %u to %u\n", (unsigned int)start, (unsigned int)end);
|
||||
CHIAKI_LOGD(stream_connection->log, "StreamConnection reporting corrupt frame(s) from %u to %u", (unsigned int)start, (unsigned int)end);
|
||||
return chiaki_takion_send_message_data(&stream_connection->takion, 1, 2, buf, stream.bytes_written);
|
||||
}
|
||||
|
|
|
@ -914,24 +914,22 @@ static void takion_handle_packet_message_data_ack(ChiakiTakion *takion, uint8_t
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t seq_num = ntohl(*((uint32_t *)(buf + 0)));
|
||||
uint32_t cumulative_seq_num = ntohl(*((uint32_t *)(buf + 0)));
|
||||
uint32_t a_rwnd = ntohl(*((uint32_t *)(buf + 4)));
|
||||
uint16_t size_internal = ntohs(*((uint16_t *)(buf + 8)));
|
||||
uint16_t zero = ntohs(*((uint16_t *)(buf + 0xa)));
|
||||
uint16_t gap_ack_blocks_count = ntohs(*((uint16_t *)(buf + 8)));
|
||||
uint16_t dup_tsns_count = ntohs(*((uint16_t *)(buf + 0xa)));
|
||||
|
||||
// this check is basically size_or_something != 0, but it is done like that in the original code,
|
||||
// so I assume size_or_something may be the size of additional data coming after the data ack header.
|
||||
if(buf_size != size_internal * 4 + 0xc)
|
||||
if(buf_size != gap_ack_blocks_count * 4 + 0xc)
|
||||
{
|
||||
CHIAKI_LOGW(takion->log, "Takion received data ack with invalid size_internal = %#x", size_internal);
|
||||
CHIAKI_LOGW(takion->log, "Takion received data ack with invalid gap_ack_blocks_count");
|
||||
return;
|
||||
}
|
||||
|
||||
if(zero != 0)
|
||||
CHIAKI_LOGW(takion->log, "Takion received data ack with nonzero %#x at buf+0xa", zero);
|
||||
if(dup_tsns_count != 0)
|
||||
CHIAKI_LOGW(takion->log, "Takion received data ack with nonzero dup_tsns_count %#x", dup_tsns_count);
|
||||
|
||||
//CHIAKI_LOGD(takion->log, "Takion received data ack with seq_num = %#x, something = %#x, size_or_something = %#x, zero = %#x", seq_num, something, size_internal, zero);
|
||||
chiaki_takion_send_buffer_ack(&takion->send_buffer, seq_num);
|
||||
chiaki_takion_send_buffer_ack(&takion->send_buffer, cumulative_seq_num);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -145,7 +145,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_send_buffer_ack(ChiakiTakionSendBuff
|
|||
size_t i;
|
||||
for(i=0; i<send_buffer->packets_count; i++)
|
||||
{
|
||||
if(send_buffer->packets[i].seq_num == seq_num)
|
||||
if(send_buffer->packets[i].seq_num == seq_num) // TODO: should be <= (with seqnum arithmetic)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_send_buffer_ack(ChiakiTakionSendBuff
|
|||
free(send_buffer->packets[i].buf);
|
||||
|
||||
if(i < send_buffer->packets_count - 1)
|
||||
memmove(send_buffer->packets + i, send_buffer->packets + i + 1, send_buffer->packets_count - i - 1);
|
||||
memmove(send_buffer->packets + i, send_buffer->packets + i + 1, (send_buffer->packets_count - i - 1) * sizeof(ChiakiTakionSendBufferPacket));
|
||||
|
||||
send_buffer->packets_count--;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue