diff --git a/source/lib/network/object_sharer.py b/source/lib/network/object_sharer.py index 100f2f47..ff9de81f 100644 --- a/source/lib/network/object_sharer.py +++ b/source/lib/network/object_sharer.py @@ -16,7 +16,10 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import logging -import pickle +try: + import cPickle as pickle +except: + import pickle import socket from lib.network import tcpserver import copy @@ -24,6 +27,7 @@ import inspect import time import gobject +import types PORT = 12002 BUFSIZE = 8192 @@ -313,8 +317,15 @@ def handle_packet(self, conn, packet): if callid not in self._return_cbs: logging.warning('Return received for unknown call %d', callid) return + func = self._return_cbs[callid] del self._return_cbs[callid] + + if type(callinfo) == types.StringType and callinfo.startswith('sharedname:'): + sn = callinfo[11:] + logging.debug('Received shared object reference, finding %s', sn) + callinfo = helper.find_object(sn) + func(callinfo) return @@ -342,6 +353,11 @@ def handle_packet(self, conn, packet): # No need to send return return + if isinstance(ret, SharedObject): + sn = root.get_instance_name() + ':' + ret.get_shared_name() + logging.debug('Returning a shared object reference: %s', sn) + ret = 'sharedname:' + sn + self._send_return(conn, info[1], ret) def _do_send_raw(self, conn, data): @@ -712,6 +728,7 @@ def get_object(self, objname): 'properties': props, 'functions': funcs } + return info def receive_signal(self, objname, signame, *args, **kwargs):