internal object GetClientStub(WrappedServiceStub innerstub) { if (innerstub == null) { return(null); } lock (this) { int id = innerstub.GetObjectHeapID(); object stub; if (id != 0 && client_stubs.TryGetValue(id, out stub)) { return(stub); } else { ServiceFactory f; f = RobotRaconteurNode.s.GetServiceType(innerstub.RR_objecttype.GetServiceDefinition().Name); stub = f.CreateStub(innerstub); int id2 = innerstub.GetObjectHeapID(); if (id2 == 0) { return(null); } client_stubs.Add(id2, stub); return(stub); } } }
public override void handler(WrappedServiceStub innerstub, HandlerErrorInfo error) { try { if (error.error_code != 0) { using (MessageEntry merr = new MessageEntry()) { this.handler_task.SetException(RobotRaconteurExceptionUtil.ErrorInfoToException(error)); return; } } object s = null; T s1 = default(T); try { int id = innerstub.GetObjectHeapID(); if (id != 0) { handler_task.SetResult((T)RRObjectHeap.GetObject(id)); return; } ServiceFactory f; if (factory == null) { f = RobotRaconteurNode.s.GetServiceType(innerstub.RR_objecttype.GetServiceDefinition().Name); } else { f = factory; } s = f.CreateStub(innerstub); s1 = (T)s; } catch (Exception e) { handler_task.SetException(e); return; } handler_task.SetResult(s1); } catch (Exception e) { using (MessageEntry merr = new MessageEntry()) { RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr); RRDirectorExceptionHelper.SetError(merr, e.ToString()); } } }
internal object DeleteClientStub(WrappedServiceStub innerstub) { if (innerstub == null) { return(null); } lock (this) { int id = innerstub.GetObjectHeapID(); if (id != 0) { object stub; if (client_stubs.TryGetValue(id, out stub)) { client_stubs.Remove(id); return(stub); } } return(null); } }