add participation and log spam fix
This commit is contained in:
parent
100279a483
commit
eb169b2779
@ -560,9 +560,9 @@ void SHA1_NGCFT1::onSendFileHashFinished(ObjectHandle o, Message3Registry* reg_p
|
|||||||
updateMessages(o); // nop // TODO: remove
|
updateMessages(o); // nop // TODO: remove
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHA1_NGCFT1::constructFileMessageInPlace(Message3Handle msg, NGCFT1_file_kind file_kind, ByteSpan file_id) {
|
ObjectHandle SHA1_NGCFT1::constructFileMessageInPlace(Message3Handle msg, NGCFT1_file_kind file_kind, ByteSpan file_id) {
|
||||||
if (file_kind != NGCFT1_file_kind::HASH_SHA1_INFO) {
|
if (file_kind != NGCFT1_file_kind::HASH_SHA1_INFO) {
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if content exists
|
// check if content exists
|
||||||
@ -624,6 +624,8 @@ void SHA1_NGCFT1::constructFileMessageInPlace(Message3Handle msg, NGCFT1_file_ki
|
|||||||
}
|
}
|
||||||
|
|
||||||
_os.throwEventUpdate(o);
|
_os.throwEventUpdate(o);
|
||||||
|
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHA1_NGCFT1::onEvent(const ObjectStore::Events::ObjectUpdate& e) {
|
bool SHA1_NGCFT1::onEvent(const ObjectStore::Events::ObjectUpdate& e) {
|
||||||
@ -1304,7 +1306,12 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_message& e) {
|
|||||||
rb.try_emplace(self_c, ts);
|
rb.try_emplace(self_c, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
constructFileMessageInPlace({reg, new_msg_e}, e.file_kind, {e.file_id, e.file_id_size});
|
auto o = constructFileMessageInPlace({reg, new_msg_e}, e.file_kind, {e.file_id, e.file_id_size});
|
||||||
|
|
||||||
|
if (o) {
|
||||||
|
// the other peer just sent the file message, so it is likely they have the file
|
||||||
|
addParticipation(c, o);
|
||||||
|
}
|
||||||
|
|
||||||
_rmm.throwEventConstruct(reg, new_msg_e);
|
_rmm.throwEventConstruct(reg, new_msg_e);
|
||||||
|
|
||||||
|
@ -108,8 +108,7 @@ class SHA1_NGCFT1 : public ToxEventI, public RegistryMessageModelEventI, public
|
|||||||
void onSendFileHashFinished(ObjectHandle o, Message3Registry* reg_ptr, Contact3 c, uint64_t ts);
|
void onSendFileHashFinished(ObjectHandle o, Message3Registry* reg_ptr, Contact3 c, uint64_t ts);
|
||||||
|
|
||||||
// construct the file part in a partially constructed message
|
// construct the file part in a partially constructed message
|
||||||
// TODO: maybe return file object?
|
ObjectHandle constructFileMessageInPlace(Message3Handle msg, NGCFT1_file_kind file_kind, ByteSpan file_id);
|
||||||
void constructFileMessageInPlace(Message3Handle msg, NGCFT1_file_kind file_kind, ByteSpan file_id);
|
|
||||||
|
|
||||||
protected: // rmm events (actions)
|
protected: // rmm events (actions)
|
||||||
bool sendFilePath(const Contact3 c, std::string_view file_name, std::string_view file_path) override;
|
bool sendFilePath(const Contact3 c, std::string_view file_name, std::string_view file_path) override;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// perform binary search to find the first message not newer than ts_start
|
// perform binary search to find the first message not newer than ts_start
|
||||||
template<typename View>
|
template<typename View>
|
||||||
auto find_start_by_ts(const View& view, uint64_t ts_start) {
|
auto find_start_by_ts(const View& view, uint64_t ts_start) {
|
||||||
std::cout << "!!!! starting msg ts search, ts_start:" << ts_start << "\n";
|
//std::cout << "!!!! starting msg ts search, ts_start:" << ts_start << "\n";
|
||||||
|
|
||||||
// -> first value smaller than start ts
|
// -> first value smaller than start ts
|
||||||
auto res = std::lower_bound(
|
auto res = std::lower_bound(
|
||||||
@ -22,9 +22,9 @@ auto find_start_by_ts(const View& view, uint64_t ts_start) {
|
|||||||
|
|
||||||
if (res != view.end()) {
|
if (res != view.end()) {
|
||||||
const auto& [ts_comp] = view.get(*res);
|
const auto& [ts_comp] = view.get(*res);
|
||||||
std::cout << "!!!! first value not newer than start ts is " << ts_comp.ts << "\n";
|
//std::cout << "!!!! first value not newer than start ts is " << ts_comp.ts << "\n";
|
||||||
} else {
|
} else {
|
||||||
std::cout << "!!!! no first value not newer than start ts\n";
|
//std::cout << "!!!! no first value not newer than start ts\n";
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user