Esempio n. 1
0
        /// <summary>
        /// Override to perform custom transport preparation and launch
        /// </summary>
        protected virtual void ConfigureAndStartNewClientTransport(ClientTransport transport)
        {
            var cfg = ConfigNode.NavigateSection(CONFIG_CLIENT_TRANSPORT_SECTION);

            if (!cfg.Exists)
            {
                cfg = ConfigNode;
            }
            transport.Configure(cfg);
            transport.Start();     //this will fail if runtime is shutting down
        }
Esempio n. 2
0
        /// <summary>
        /// INTERNAL METHOD. Developers do not call!
        /// This constructor is used by an Async binding that delivers response after call slot was created
        /// </summary>
        public CallSlot(ClientEndPoint client, ClientTransport clientTransport, RequestMsg request, CallStatus status, int timeoutMs = 0)
        {
            m_Client          = client;
            m_ClientTransport = clientTransport;
            m_RequestID       = request.RequestID;
            m_CallStatus      = status;
            m_OneWay          = request.OneWay;
            m_StartTime       = DateTime.UtcNow;
            m_TimeoutMs       = timeoutMs > 0 ? timeoutMs : DEFAULT_TIMEOUT_MS;

            if (!m_OneWay && client.Binding.MeasureStatTimes)
            {
                m_StatStartTimeTicks   = client.Binding.StatTimeTicks;
                m_StatRoundtripTimeKey = client.Binding.GetClientCallStatTimeKey(client, request);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// INTERNAL METHOD. Developers do not call!
        /// This constructor is used by a synchronous binding that delivers response right after sending it.
        /// ONLY for OneWayCall = false
        /// </summary>
        public CallSlot(ClientEndPoint client,
                        ClientTransport clientTransport,
                        long actualStartTimeTicks,
                        DateTime actualStartTimeUtc,
                        RequestMsg request,
                        ResponseMsg response,
                        int timeoutMs)
        {
            m_Client          = client;
            m_ClientTransport = clientTransport;
            m_RequestID       = request.RequestID;
            m_OneWay          = false;
            m_StartTime       = actualStartTimeUtc;
            m_TimeoutMs       = timeoutMs > 0 ? timeoutMs : DEFAULT_TIMEOUT_MS;

            if (client.Binding.MeasureStatTimes)
            {
                m_StatStartTimeTicks   = actualStartTimeTicks;
                m_StatRoundtripTimeKey = client.Binding.GetClientCallStatTimeKey(client, request);
            }

            m_ResponseMsg = response;
            m_CallStatus  = m_ResponseMsg.OK ? CallStatus.ResponseOK : CallStatus.ResponseError;
            var remoteInstance = response.RemoteInstance;

            if (remoteInstance.HasValue)
            {
                m_Client.__setRemoteInstance(remoteInstance.Value);
            }

            if (m_StatRoundtripTimeKey != null && m_Client.Binding.MeasureStatTimes)
            {
                m_StatRoundtripEndTimeTicks = m_Client.Binding.StatTimeTicks;
                m_ClientTransport.stat_Time(m_StatRoundtripTimeKey, m_StatRoundtripEndTimeTicks - m_StatStartTimeTicks);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Releases a transport instance that was acquired for call.
 /// The implementation may return this instance back to the pool of available transports or deallocate it.
 /// The default implementation releases the instance back to the pool
 /// </summary>
 protected internal virtual void ReleaseClientTransportAfterCall(ClientTransport transport)
 {
     transport.Release();
 }