Skip to content

Commit dd53980

Browse files
committed
record actual number of conference peers saved
1 parent 3282af9 commit dd53980

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

toxcore/group.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,7 +3093,7 @@ static uint8_t *save_conf(const Group_c *g, uint8_t *data)
30933093
host_to_lendian_bytes16(data, g->peer_number);
30943094
data += sizeof(uint16_t);
30953095

3096-
host_to_lendian_bytes32(data, g->numpeers - 1 + g->numfrozen);
3096+
uint8_t *numsaved_location = data;
30973097
data += sizeof(uint32_t);
30983098

30993099
*data = g->title_len;
@@ -3102,24 +3102,20 @@ static uint8_t *save_conf(const Group_c *g, uint8_t *data)
31023102
memcpy(data, g->title, g->title_len);
31033103
data += g->title_len;
31043104

3105-
#ifndef NDEBUG
3106-
bool found_self = false;
3107-
#endif
3105+
uint32_t numsaved = 0;
31083106

31093107
for (uint32_t j = 0; j < g->numpeers + g->numfrozen; ++j) {
31103108
const Group_Peer *peer = (j < g->numpeers) ? &g->group[j] : &g->frozen[j - g->numpeers];
31113109

31123110
if (id_equal(peer->real_pk, g->real_pk)) {
3113-
#ifndef NDEBUG
3114-
found_self = true;
3115-
#endif
31163111
continue;
31173112
}
31183113

31193114
data = save_peer(peer, data);
3115+
++numsaved;
31203116
}
31213117

3122-
assert(found_self);
3118+
host_to_lendian_bytes32(numsaved_location, numsaved);
31233119

31243120
return data;
31253121
}

0 commit comments

Comments
 (0)