From 9a4be575bab9627abec08af6b6c328a21aa4ecf4 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 23 Oct 2024 12:51:22 +0200 Subject: [PATCH] minor stuff and logging --- solanaceae/ngc_ext/ngcext.hpp | 4 ++++ solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/solanaceae/ngc_ext/ngcext.hpp b/solanaceae/ngc_ext/ngcext.hpp index 250912d..61b20b9 100644 --- a/solanaceae/ngc_ext/ngcext.hpp +++ b/solanaceae/ngc_ext/ngcext.hpp @@ -30,6 +30,7 @@ namespace Events { uint32_t peer_number; // respond to a request with 0 or more message ids, sorted by newest first + // - peer_key bytes (the msg_ids are from) ToxKey peer_key; @@ -47,6 +48,7 @@ namespace Events { uint32_t peer_number; // request the other side to initiate a FT + // - 4 byte (file_kind) uint32_t file_kind; @@ -59,6 +61,7 @@ namespace Events { uint32_t peer_number; // tell the other side you want to start a FT + // - 4 byte (file_kind) uint32_t file_kind; @@ -88,6 +91,7 @@ namespace Events { uint32_t peer_number; // data fragment + // - 1 byte (temporary_file_tf_id) uint8_t transfer_id; diff --git a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp index b331c6e..5f1b6be 100644 --- a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp +++ b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp @@ -855,6 +855,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_init& e) { bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) { if (!_receiving_transfers.containsPeerTransfer(e.group_number, e.peer_number, e.transfer_id)) { + std::cerr << "SHA1_NGCFT1 waring: unknown transfer " << e.transfer_id << " from " << e.group_number << ":" << e.peer_number << "\n"; return false; } @@ -862,6 +863,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) { transfer.time_since_activity = 0.f; if (transfer.isInfo()) { + std::cout << "SHA1_NGCFT1: got info data " << e.data_size << "@" << e.data_offset << " from " << e.group_number << ":" << e.peer_number << "\n"; auto& info_data = transfer.getInfo().info_data; for (size_t i = 0; i < e.data_size && i + e.data_offset < info_data.size(); i++) { info_data[i+e.data_offset] = e.data[i]; @@ -875,6 +877,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) { auto* file2 = objGetFile2Write(o); if (file2 == nullptr) { + std::cerr << "SHA1_NGCFT1 error: writing file failed, no file object\n"; return false; // early out } if (!file2->write({e.data, e.data_size}, offset_into_file + e.data_offset)) {