Exemplo n.º 1
0
        //received response from wire
        public void OnWireReceived(UnsafeReader reader)
        {
            var resultFromWire = RdTaskResult <TRes> .Read(myCall.ReadResponseDelegate, myCall.SerializationContext, reader);

            if (RdReactiveBase.LogReceived.IsTraceEnabled())
            {
                RdReactiveBase.LogReceived.Trace($"call {myCall.Location} ({myCall.RdId}) received response for task '{RdId}' : {resultFromWire.PrintToString()}");
            }

            Scheduler.Queue(() =>
            {
                using (myCall.UsingDebugInfo())
                {
                    if (ResultInternal.SetIfEmpty(resultFromWire))
                    {
                        return;
                    }
                }

                //trace
                if (RdReactiveBase.LogReceived.IsTraceEnabled())
                {
                    RdReactiveBase.LogReceived.Trace($"call {myCall.Location} ({myCall.RdId}) response for task '{RdId}' was dropped, because task already has result: {Result.Value}");
                }

                myLifetimeDef.Terminate(); //todo not true in case of bindable entities
            });
        }
Exemplo n.º 2
0
        //received response from wire
        public void OnWireReceived(UnsafeReader reader)
        {
            using (myCall.UsingDebugInfo())
            {
                if (myIsEndpoint) //we are on endpoint side, so listening for cancellation
                {
                    Trace(RdReactiveBase.ourLogReceived, "received cancellation");
                    reader.ReadVoid(); //nothing just a void value
                    ResultInternal.SetIfEmpty(RdTaskResult <TRes> .Cancelled());
                }

                else // we are at call side, so listening no response and bind it if it's bindable
                {
                    var resultFromWire = RdTaskResult <TRes> .Read(myCall.ReadResponseDelegate, myCall.SerializationContext, reader);

                    Trace(RdReactiveBase.ourLogReceived, "received response", resultFromWire);

                    if (!ResultInternal.SetIfEmpty(resultFromWire))
                    {
                        Trace(RdReactiveBase.ourLogReceived, "response from wire was rejected because task already has result");
                    }
                }
            }
        }