From: <dg...@su...> - 2009-01-15 20:19:13
|
Author: friedrich.beckmann Date: Thu Jan 15 21:18:12 2009 New Revision: 5156 URL: http://www.opensync.org/changeset/5156 Log: when an error happens during osync_engine_initialize, osync_engine_finalize could not work because the state was still UNINITIALIZED - threads were still running Modified: trunk/opensync/engine/opensync_engine.c trunk/opensync/engine/opensync_engine.h Modified: trunk/opensync/engine/opensync_engine.c ============================================================================== --- trunk/opensync/engine/opensync_engine.c Thu Jan 15 19:50:07 2009 (r5155) +++ trunk/opensync/engine/opensync_engine.c Thu Jan 15 21:18:12 2009 (r5156) @@ -1436,9 +1436,10 @@ if (engine->state != OSYNC_ENGINE_STATE_UNINITIALIZED) { osync_error_set(error, OSYNC_ERROR_MISCONFIGURATION, "This engine was not uninitialized: %i", engine->state); - goto error; + goto error_no_state_reset; } - + + engine->state = OSYNC_ENGINE_STATE_START_INIT; group = engine->group; if (osync_group_num_members(group) < 2) { @@ -1524,6 +1525,8 @@ osync_engine_finalize(engine, NULL); osync_group_unlock(engine->group); error: + engine->state = OSYNC_ENGINE_STATE_UNINITIALIZED; + error_no_state_reset: osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; } @@ -1532,8 +1535,8 @@ { OSyncClientProxy *proxy = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, engine, error); - - if (engine->state != OSYNC_ENGINE_STATE_INITIALIZED) { + + if (engine->state != OSYNC_ENGINE_STATE_START_INIT && engine->state != OSYNC_ENGINE_STATE_INITIALIZED) { osync_error_set(error, OSYNC_ERROR_MISCONFIGURATION, "This engine was not in state initialized: %i", engine->state); goto error; } Modified: trunk/opensync/engine/opensync_engine.h ============================================================================== --- trunk/opensync/engine/opensync_engine.h Thu Jan 15 19:50:07 2009 (r5155) +++ trunk/opensync/engine/opensync_engine.h Thu Jan 15 21:18:12 2009 (r5156) @@ -85,6 +85,8 @@ typedef enum { /** Uninitialized */ OSYNC_ENGINE_STATE_UNINITIALIZED, + /** Start Initialization **/ + OSYNC_ENGINE_STATE_START_INIT, /** Initialized */ OSYNC_ENGINE_STATE_INITIALIZED, /** Waiting for synchronization request by a peer */ |