|
From: <svn...@op...> - 2010-01-10 17:34:15
|
Author: dgollub Date: Sun Jan 10 18:34:06 2010 New Revision: 5991 URL: http://www.opensync.org/changeset/5991 Log: Reset slow-sync set to allow multiple syncs (multi-sync) with one initialized OSyncEngine. Slow-sync reset was always unclean and only got reseted after the next connect() call. Since slow-syncs now can be triggered even before a connect (e.g. hashtable deletion) things needed to get cleaned up. Since sync-done() function is the very last plugin call in a multi-sync the slow-sync state get rested there for OSyncClientProxy and OSyncClient. refs #960 Modified: trunk/opensync/client/opensync_client.c trunk/opensync/client/opensync_client_proxy.c Modified: trunk/opensync/client/opensync_client.c ============================================================================== --- trunk/opensync/client/opensync_client.c Sun Jan 10 18:29:30 2010 (r5990) +++ trunk/opensync/client/opensync_client.c Sun Jan 10 18:34:06 2010 (r5991) @@ -1071,14 +1071,9 @@ osync_message_unref(reply); } else { - /* set slowsync. - otherwise disable slowsync - to avoid slowsyncs every time with the same initiliazed engine - without finalizing the engine the next sync with the same engine would be again a slow-sync. - (unittest: sync - testcases: sync_easy_new_del, sync_easy_new_mapping) */ + /* set slowsync. but never disable it */ if (slowsync) osync_objtype_sink_set_slowsync(sink, TRUE); - else - osync_objtype_sink_set_slowsync(sink, FALSE); context = _create_context(client, message, _osync_client_connect_callback, NULL, error); if (!context) @@ -1148,11 +1143,10 @@ goto error; /* set slowsync (again) if the slow-sync got requested during the connect() call - of a member - and not during frontend/engine itself (e.g. anchor mismatch). */ + of a member - and not during frontend/engine itself (e.g. anchor mismatch). + Never disable a slowsync.*/ if (slowsync) osync_objtype_sink_set_slowsync(sink, TRUE); - else - osync_objtype_sink_set_slowsync(sink, FALSE); osync_plugin_info_set_sink(client->plugin_info, sink); osync_objtype_sink_connect_done(sink, client->plugin_info, context); @@ -1498,6 +1492,10 @@ if (!osync_objtype_sink_save_hashtable(sink, error)) goto error; + + /* Reset slow-sync state. The sink is here over. + * Reset is requried for a multi-sync, without finalization.*/ + osync_objtype_sink_set_slowsync(sink, FALSE); } osync_trace(TRACE_EXIT, "%s", __func__); return TRUE; Modified: trunk/opensync/client/opensync_client_proxy.c ============================================================================== --- trunk/opensync/client/opensync_client_proxy.c Sun Jan 10 18:29:30 2010 (r5990) +++ trunk/opensync/client/opensync_client_proxy.c Sun Jan 10 18:34:06 2010 (r5991) @@ -1900,9 +1900,15 @@ goto error; sink = osync_client_proxy_find_objtype_sink(proxy, objtype); - if (sink) + if (sink) { timeout = osync_objtype_sink_get_syncdone_timeout_or_default(sink); + /* Reset the slow-sync state in the client-proxy OSyncObjTypeSink object, since finalize might + * not get called in a multi-sync + */ + osync_objtype_sink_set_slowsync(sink, FALSE); + } + ctx->proxy = proxy; ctx->sync_done_callback = callback; ctx->sync_done_callback_data = userdata; |