ssb: No longer replicate every account we hear about.
This commit is contained in:
parent
0cb5025a16
commit
75c71135ba
@ -148,14 +148,14 @@ static void _ebt_add_to_clock(ebt_get_clock_t* work, const char* id, int64_t val
|
||||
{
|
||||
int count = work->clock ? work->clock->count : 0;
|
||||
ebt_entry_t* entry = _ebt_get_entry(work->ebt, id);
|
||||
if (entry->out_replicate != replicate || entry->out_receive != receive || ((replicate || receive) && entry->out != value))
|
||||
if ((replicate && !entry->out_replicate) || (receive && !entry->out_receive) || ((replicate || receive || entry->out_replicate || entry->out_receive) && entry->out != value))
|
||||
{
|
||||
entry->out = value;
|
||||
entry->out_replicate = replicate;
|
||||
entry->out_receive = receive;
|
||||
entry->out_replicate = entry->out_replicate || replicate;
|
||||
entry->out_receive = entry->out_receive || receive;
|
||||
|
||||
int index = tf_util_insert_index(id, count ? work->clock->entries : NULL, count, sizeof(tf_ssb_ebt_clock_entry_t), _ebt_compare_entry);
|
||||
int64_t out_value = replicate ? ((value << 1) | (receive ? 0 : 1)) : -1;
|
||||
int64_t out_value = entry->out_replicate ? ((value << 1) | (entry->out_receive ? 0 : 1)) : -1;
|
||||
if (index < count && strcmp(id, work->clock->entries[index].id) == 0)
|
||||
{
|
||||
work->clock->entries[index].value = out_value;
|
||||
@ -229,7 +229,7 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
if (entry->in_replicate && !entry->out_replicate)
|
||||
{
|
||||
requested = tf_resize_vec(requested, (requested_count + 1) * sizeof(tf_ssb_ebt_clock_entry_t));
|
||||
requested[requested_count] = (tf_ssb_ebt_clock_entry_t) { 0 };
|
||||
requested[requested_count] = (tf_ssb_ebt_clock_entry_t) { .value = -1 };
|
||||
snprintf(requested[requested_count].id, sizeof(requested[requested_count].id), "%s", entry->id);
|
||||
requested_count++;
|
||||
}
|
||||
@ -246,7 +246,7 @@ static void _tf_ssb_ebt_get_send_clock_work(tf_ssb_connection_t* connection, voi
|
||||
uv_mutex_lock(&work->ebt->mutex);
|
||||
for (int i = 0; i < requested_count; i++)
|
||||
{
|
||||
_ebt_add_to_clock(work, requested[i].id, requested[i].value, true, true);
|
||||
_ebt_add_to_clock(work, requested[i].id, requested[i].value, requested[i].value >= 0, false);
|
||||
}
|
||||
uv_mutex_unlock(&work->ebt->mutex);
|
||||
tf_free(requested);
|
||||
|
Loading…
Reference in New Issue
Block a user