]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
forb: object serialization working even for inter-executor invocation
authorPetr Benes <benesp16@fel.cvut.cz>
Tue, 15 Feb 2011 12:24:14 +0000 (13:24 +0100)
committerPetr Benes <benesp16@fel.cvut.cz>
Tue, 15 Feb 2011 12:24:14 +0000 (13:24 +0100)
in case the object being deserialized indicates being local,
it is not being created from scratch, however just copied

src/object.c

index 7fdac275e0129261e8e7e739b256ac4ad2c45e37..51ca531d6efaa7c541232a05eaaed7aa1d6f3cc4 100644 (file)
@@ -61,6 +61,9 @@
 #include <forb/cdr.h>
 #include "forb_utils.h"
 #include <inttypes.h>
+#include "object_type.h"
+#include <forb/types.h>
+#include <forb/server_id.h>
 
 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;
 }