Example #1
0
 private EndPointRegistration RpcFind( EndPoint ep )
 {
     return RpcFind( ep.m_type, ep.m_id, false );
 }
Example #2
0
        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." );
            }
        }
Example #3
0
        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 );
                }
            }
        }
Example #4
0
 internal Message(EndPoint source, Commands.Debugging_Messaging_Address addr, byte[] payload)
 {
     m_source = source;
     m_addr = addr;
     m_payload = payload;
 }
Example #5
0
 internal EndPointRegistration( EndPoint ep )
 {
     m_ep = ep;
     m_req_Outbound = ArrayList.Synchronized( new ArrayList( ) );
 }
Example #6
0
 internal bool CheckDestination(EndPoint ep)
 {
     return m_eng.RpcCheck(InitializeAddressForTransmission(ep));
 }
Example #7
0
        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;
        }
Example #8
0
 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;
     }
 }
Example #9
0
            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;
            }
Example #10
0
        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();
        }
Example #11
0
 internal byte[] SendMessageInner(EndPoint ep, int timeout, byte[] data)
 {
     return m_eng.RpcSend(InitializeAddressForTransmission(ep), timeout, data);
 }
Example #12
0
        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;
        }