private EndPointRegistration RpcFind( EndPoint ep ) { return RpcFind( ep.m_type, ep.m_id, false ); }
internal void RpcRegisterEndPoint( EndPoint ep ) { EndPointRegistration eep = RpcFind( ep ); bool fSuccess = false; if( eep == null ) { IControllerRemote remote = m_ctrl as IControllerRemote; if( remote != null ) { fSuccess = remote.RegisterEndpoint( ep.m_type, ep.m_id ); } else { fSuccess = true; } if( fSuccess ) { lock( m_rpcEndPoints.SyncRoot ) { eep = RpcFind( ep ); if( eep == null ) { m_rpcEndPoints.Add( new EndPointRegistration( ep ) ); } else { fSuccess = false; } } } } if( !fSuccess ) { throw new ApplicationException( "Endpoint already registered." ); } }
internal void RpcDeregisterEndPoint( EndPoint ep ) { EndPointRegistration eep = RpcFind( ep ); if( eep != null ) { m_rpcEndPoints.Remove( eep ); eep.Destroy( ); IControllerRemote remote = m_ctrl as IControllerRemote; if( remote != null ) { remote.DeregisterEndpoint( ep.m_type, ep.m_id ); } } }
internal Message(EndPoint source, Commands.Debugging_Messaging_Address addr, byte[] payload) { m_source = source; m_addr = addr; m_payload = payload; }
internal EndPointRegistration( EndPoint ep ) { m_ep = ep; m_req_Outbound = ArrayList.Synchronized( new ArrayList( ) ); }
internal bool CheckDestination(EndPoint ep) { return m_eng.RpcCheck(InitializeAddressForTransmission(ep)); }
private Commands.Debugging_Messaging_Address InitializeAddressForTransmission(EndPoint epTo) { Commands.Debugging_Messaging_Address addr = new Commands.Debugging_Messaging_Address(); addr.m_seq = (uint)Interlocked.Increment(ref m_seq); addr.m_from_Type = m_type; addr.m_from_Id = m_id; addr.m_to_Type = epTo.m_type; addr.m_to_Id = epTo.m_id; return addr; }
public void Dispose() { try { if (m_from != null) { m_from.Deregister(); } } catch { } finally { m_eng = null; m_from = null; m_to = null; m_type = null; } }
internal EndPointProxy(Engine eng, EndPoint from, EndPoint to, Type type) : base(type) { from.Register(); if (from.CheckDestination(to) == false) { from.Deregister(); throw new ArgumentException("Cannot connect to device EndPoint"); } m_eng = eng; m_from = from; m_to = to; m_type = type; }
static internal object GetObject(Engine eng, EndPoint ep, Type classToRemote) { uint id = eng.RpcGetUniqueEndpointId(); EndPoint epLocal = new EndPoint(typeof(EndPointProxy), id, eng); EndPointProxy prx = new EndPointProxy(eng, epLocal, ep, classToRemote); return prx.GetTransparentProxy(); }
internal byte[] SendMessageInner(EndPoint ep, int timeout, byte[] data) { return m_eng.RpcSend(InitializeAddressForTransmission(ep), timeout, data); }
internal object SendMessage(EndPoint ep, int timeout, MessageCall call) { object data = call.CreateMessagePayload(); byte[] payload = m_eng.CreateBinaryFormatter().Serialize(data); byte[] res = SendMessageInner(ep, timeout, payload); if (res == null) { throw new RemotingException(string.Format("Remote call '{0}' failed", call.Name)); } object o = m_eng.CreateBinaryFormatter().Deserialize(res); Messaging.RemotedException ex = o as Messaging.RemotedException; if (ex != null) { ex.Raise(); } return o; }