Skip to content

client: Prevent concurent sync loop

Anthony PERARD requested to merge aperard/libcmatrix:fix-sync into main

Currently, changes in network connectivity (notified via matrix_network_changed_cb()) can lead libcmatrix to run more than one sync task (red_pill) at a time. This happens when cm_client_stop_sync() is called followed by several call of cm_client_start_sync(). (and when filter_id is already set)

cm_client_start_sync() is supposed to prevent matrix_start_sync() again when is_sync or is_logging_in is set, but nothing sets those when matrix_take_red_pill() is called. is_sync is only set by the callback, but that's too late.

So, we will set is_logging_in via client_set_login_state() when we are restarting to sync with the server.

Fixes #14 (closed)

Merge request reports