Skip to content

Commit f10026f

Browse files
committed
set_pending_send marks config as needing dump on change
1 parent a4ac5db commit f10026f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

include/session/config/groups/members.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,13 @@ class Members : public ConfigBase {
344344
/// API: groups/Members::set_pending_send
345345
///
346346
/// This function can be used to set the pending send state of a member.
347+
/// If that effectively made a change, it will set _needs_dump to true.
347348
///
348349
/// Inputs:
349350
/// - `pubkey_hex` -- hex string of the session id
350351
/// - `pending` -- pending send state to set for that member
351352
///
352-
/// Outputs:
353-
/// - `bool` - true if a change was made.
354-
bool set_pending_send(std::string pubkey_hex, bool pending);
353+
void set_pending_send(std::string pubkey_hex, bool pending);
355354

356355
/// API: groups/Members::get_status
357356
///

src/config/groups/members.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ bool Members::erase(std::string_view session_id) {
150150
bool ret = info.exists();
151151
info.erase();
152152

153-
if (set_pending_send(std::string(session_id), false))
154-
_needs_dump = true;
153+
set_pending_send(std::string(session_id), false);
155154

156155
return ret;
157156
}
@@ -166,11 +165,14 @@ bool Members::has_pending_send(std::string pubkey_hex) const {
166165
return pending_send_ids.count(pubkey_hex);
167166
}
168167

169-
bool Members::set_pending_send(std::string pubkey_hex, bool pending) {
168+
void Members::set_pending_send(std::string pubkey_hex, bool pending) {
169+
bool changed = false;
170170
if (pending)
171-
return pending_send_ids.insert(pubkey_hex).second;
171+
changed = pending_send_ids.insert(pubkey_hex).second;
172172
else
173-
return pending_send_ids.erase(pubkey_hex);
173+
changed = pending_send_ids.erase(pubkey_hex);
174+
if(changed)
175+
_needs_dump = true;
174176
}
175177

176178
member::member(std::string sid) : session_id{std::move(sid)} {

0 commit comments

Comments
 (0)