23 lines
1.1 KiB
Diff
23 lines
1.1 KiB
Diff
# UNDF: UNDF-2026-000000115
|
|
--- a/src/jamidht/conversation.cpp
|
|
+++ b/src/jamidht/conversation.cpp
|
|
@@ -783,7 +783,7 @@ Conversation::loadMessages(...)
|
|
- std::vector<std::string> replies;
|
|
+ std::unordered_set<std::string> replies;
|
|
std::vector<std::shared_ptr<libjami::SwarmMessage>> msgList;
|
|
repository_->log(
|
|
/* preCondition */
|
|
@@ -826,14 +826,11 @@ Conversation::loadMessages(...)
|
|
auto message = optMessage.value();
|
|
if (message.find("reply-to") != message.end()) {
|
|
- auto it = std::find(replies.begin(), replies.end(), message.at("reply-to"));
|
|
- if (it == replies.end()) {
|
|
- replies.emplace_back(message.at("reply-to"));
|
|
- }
|
|
+ replies.insert(message.at("reply-to")); // O(1) avg; duplicates ignored
|
|
}
|
|
- auto it = std::find(replies.begin(), replies.end(), message.at("id"));
|
|
- if (it != replies.end()) {
|
|
- replies.erase(it);
|
|
- }
|
|
+ replies.erase(message.at("id")); // O(1) avg; no-op if absent
|