minor stuff and logging
This commit is contained in:
parent
fd094b157f
commit
9a4be575ba
@ -30,6 +30,7 @@ namespace Events {
|
|||||||
uint32_t peer_number;
|
uint32_t peer_number;
|
||||||
|
|
||||||
// respond to a request with 0 or more message ids, sorted by newest first
|
// respond to a request with 0 or more message ids, sorted by newest first
|
||||||
|
|
||||||
// - peer_key bytes (the msg_ids are from)
|
// - peer_key bytes (the msg_ids are from)
|
||||||
ToxKey peer_key;
|
ToxKey peer_key;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ namespace Events {
|
|||||||
uint32_t peer_number;
|
uint32_t peer_number;
|
||||||
|
|
||||||
// request the other side to initiate a FT
|
// request the other side to initiate a FT
|
||||||
|
|
||||||
// - 4 byte (file_kind)
|
// - 4 byte (file_kind)
|
||||||
uint32_t file_kind;
|
uint32_t file_kind;
|
||||||
|
|
||||||
@ -59,6 +61,7 @@ namespace Events {
|
|||||||
uint32_t peer_number;
|
uint32_t peer_number;
|
||||||
|
|
||||||
// tell the other side you want to start a FT
|
// tell the other side you want to start a FT
|
||||||
|
|
||||||
// - 4 byte (file_kind)
|
// - 4 byte (file_kind)
|
||||||
uint32_t file_kind;
|
uint32_t file_kind;
|
||||||
|
|
||||||
@ -88,6 +91,7 @@ namespace Events {
|
|||||||
uint32_t peer_number;
|
uint32_t peer_number;
|
||||||
|
|
||||||
// data fragment
|
// data fragment
|
||||||
|
|
||||||
// - 1 byte (temporary_file_tf_id)
|
// - 1 byte (temporary_file_tf_id)
|
||||||
uint8_t transfer_id;
|
uint8_t transfer_id;
|
||||||
|
|
||||||
|
@ -855,6 +855,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_init& e) {
|
|||||||
|
|
||||||
bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) {
|
bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) {
|
||||||
if (!_receiving_transfers.containsPeerTransfer(e.group_number, e.peer_number, e.transfer_id)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,6 +863,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_data& e) {
|
|||||||
|
|
||||||
transfer.time_since_activity = 0.f;
|
transfer.time_since_activity = 0.f;
|
||||||
if (transfer.isInfo()) {
|
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;
|
auto& info_data = transfer.getInfo().info_data;
|
||||||
for (size_t i = 0; i < e.data_size && i + e.data_offset < info_data.size(); i++) {
|
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];
|
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);
|
auto* file2 = objGetFile2Write(o);
|
||||||
if (file2 == nullptr) {
|
if (file2 == nullptr) {
|
||||||
|
std::cerr << "SHA1_NGCFT1 error: writing file failed, no file object\n";
|
||||||
return false; // early out
|
return false; // early out
|
||||||
}
|
}
|
||||||
if (!file2->write({e.data, e.data_size}, offset_into_file + e.data_offset)) {
|
if (!file2->write({e.data, e.data_size}, offset_into_file + e.data_offset)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user