From: Petr Benes Date: Tue, 15 Feb 2011 12:24:14 +0000 (+0100) Subject: forb: object serialization working even for inter-executor invocation X-Git-Url: https://rtime.felk.cvut.cz/gitweb/frescor/frsh-forb.git/commitdiff_plain/38c2415b27aea91595529cffdeb36f1ecf916d4d forb: object serialization working even for inter-executor invocation in case the object being deserialized indicates being local, it is not being created from scratch, however just copied --- diff --git a/src/forb/src/object.c b/src/forb/src/object.c index 7fdac275..51ca531d 100644 --- a/src/forb/src/object.c +++ b/src/forb/src/object.c @@ -61,6 +61,9 @@ #include #include "forb_utils.h" #include +#include "object_type.h" +#include +#include GAVL_CUST_NODE_INT_IMP(forb_objects_nolock /* cust_prefix */, forb_t /* cust_root_t */, @@ -257,8 +260,12 @@ forb_string_to_object(const forb_orb orb, const char *string) ret = sscanf(&string[2*sizeof(server_id)+1], "%"SCNu64, &key); if (ret == 0 || ret == EOF) return NULL; - - obj = forb_object_new(orb, &server_id, key); + + // check if the object you want to create is local or not + if (!forb_server_id_cmp(&orb->server, &server_id)) + obj = forb_objects_find(forb_data(orb), key); + else + obj = forb_object_new(orb, &server_id, key); return obj; } @@ -318,6 +325,11 @@ forb_object_deserialize(FORB_CDR_Codec *codec, forb_object *obj) return CORBA_FALSE; if (!codec->orb) return CORBA_FALSE; - *obj = forb_object_new(codec->orb, &server_id, objkey); + + // check if the object you want to create is local or not + if (!forb_server_id_cmp(&codec->orb->server, &server_id)) + *obj = forb_objects_find(forb_data(codec->orb), objkey); + else + *obj = forb_object_new(codec->orb, &server_id, objkey); return CORBA_TRUE; }