Changeset 3543

Show
Ignore:
Timestamp:
08/16/08 16:23:59 (4 months ago)
Author:
dgollub
Message:

Fallback to "data" ObjTypeSink? if present, to allow intermix of "data"
objtype sink with other objtype sinks.

Handle conncet event where less then 2 sink engines are present.
e.g.: file-sync (data) and random-pim-plugin (contact, event) - all
objtypes links would have less then two sink engines...

Location:
trunk/opensync
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/opensync/client/opensync_client_proxy.c

    r3538 r3543  
    10281028                goto error; 
    10291029 
     1030        if (haspluginconfig) { 
     1031                OSyncList *r = osync_plugin_config_get_resources(config); 
     1032                for (; r; r = r->next) { 
     1033                        OSyncPluginResource *res = r->data; 
     1034 
     1035                        if (!osync_plugin_resource_is_enabled(res)) 
     1036                                continue; 
     1037 
     1038                        const char *objtype = osync_plugin_resource_get_objtype(res); 
     1039                        OSyncObjTypeSink *sink = osync_client_proxy_find_objtype_sink(proxy, objtype); 
     1040                         /* TODO: In discovery phase *sink COULD be NULL. Review if this is correct behavior. */ 
     1041                        if (sink) { 
     1042                                osync_objtype_sink_ref(sink); 
     1043                                proxy->objtypes = g_list_append(proxy->objtypes, sink); 
     1044                        } 
     1045                } 
     1046        } 
     1047 
    10301048#ifdef OPENSYNC_UNITTESTS 
    10311049        // Introduced (only) for testing/debugging purpose (mock-sync) 
  • trunk/opensync/engine/opensync_obj_engine.c

    r3365 r3543  
    101101                         
    102102        if (osync_bitcount(engine->sink_errors | engine->sink_connects) == g_list_length(engine->sink_engines)) { 
    103                 if (osync_bitcount(engine->sink_connects) < 2) { 
    104                         osync_error_set(&locerror, OSYNC_ERROR_GENERIC, "Less than 2 sink_engines are connected"); 
    105                         osync_obj_engine_set_error(engine, locerror); 
    106                 } else if (osync_bitcount(engine->sink_errors)) { 
     103                if (osync_bitcount(engine->sink_errors)) { 
    107104                        osync_error_set(&locerror, OSYNC_ERROR_GENERIC, "At least one sink_engine failed while connecting"); 
    108105                        osync_obj_engine_set_error(engine, locerror); 
     
    721718 
    722719        osync_trace(TRACE_INTERNAL, "Loaded %i mappings", osync_mapping_table_num_mappings(engine->mapping_table)); 
     720 
     721        const char *objtype = osync_obj_engine_get_objtype(engine); 
    723722         
    724723        int num = osync_engine_num_proxies(engine->parent); 
     
    726725        for (i = 0; i < num; i++) { 
    727726                OSyncClientProxy *proxy = osync_engine_nth_proxy(engine->parent, i); 
     727                OSyncObjTypeSink *sink = osync_client_proxy_find_objtype_sink(proxy, objtype);  
     728                if (!sink) { 
     729                        /* "data" sink engine counts also as valid. */ 
     730                        sink = osync_client_proxy_find_objtype_sink(proxy, "data");  
     731                        if (!sink) 
     732                                continue; 
     733                } 
    728734                 
    729735                OSyncSinkEngine *sinkengine = osync_sink_engine_new(i, proxy, engine, error); 
     
    916922 
    917923                                OSyncObjTypeSink *objtype_sink = osync_member_find_objtype_sink(member, engine->objtype); 
     924                                /* If sink could not be found use "data" sink if available */ 
     925                                if (!objtype_sink) 
     926                                        objtype_sink = osync_member_find_objtype_sink(member, "data"); 
     927                                /* TODO: Review if objtype_sink = NULL is valid at all. */ 
    918928 
    919929                                for (e = sinkengine->entries; e; e = e->next) {