hs init recv logic, + fs send init ack (not tracking it yet)

This commit is contained in:
2022-10-08 00:15:51 +02:00
parent bd0c45f885
commit e6803275a0
3 changed files with 59 additions and 4 deletions

View File

@@ -300,6 +300,7 @@ static void _handle_FT1_INIT(
fprintf(stderr, "]\n");
// check if slot free ?
// did we allready ack this and the other side just did not see the ack?
NGC_FT1_recv_init_cb* fn_ptr = nullptr;
if (ngc_ext_ctx->ngc_ft1_ctx->cb_init.count(file_kind)) {
@@ -316,8 +317,19 @@ static void _handle_FT1_INIT(
if (accept_ft) {
// send ack
// - 1 byte packet id
// - 1 byte transfer_id
std::vector<uint8_t> pkg;
pkg.push_back(FT1_INIT_ACK);
pkg.push_back(transfer_id);
// lossless
tox_group_send_custom_private_packet(tox, group_number, peer_number, true, pkg.data(), pkg.size(), nullptr);
fprintf(stderr, "accepted init\n");
} else {
// TODO deny?
fprintf(stderr, "rejected init\n");
}
}