Example #1
0
        void TimeoutCallback(object sender, ElapsedEventArgs e)
        {
            PendingCall callInfo = FetchPendingCall((Timer)sender);

            if (callInfo != null)
            {
                if (callInfo.OnException != null)
                {
                    callInfo.OnException(this, 0, null);
                }
            }
        }
Example #2
0
        void ProcessException(uint callId, uint type, BufferView data)
        {
            PendingCall callInfo = FetchPendingCall(callId);

            if (callInfo == null)
            {
                // Received a timeouted (or invalid) answer
                ProtocolError();
                return;
            }
            if (!callInfo.Call.HasException(type))
            {
                // Received an invalid exception type
                ProtocolError();
                return;
            }

            // Get exception definition
            Registry.RegisteredException exception = Registry.GetException(type);
            if (exception == null)
            {
                ProtocolError();
                return;
            }

            // Read the incoming data
            object inflatedData;

            try {
                inflatedData = InflateData.Inflate(data, exception.DataFormat);
            } catch {
                ProtocolError();
                return;
            }

            // Clear the timeout
            if (callInfo.Interval != null)
            {
                callInfo.Interval.Stop();
            }

            // Call the callback
            if (callInfo.OnException != null)
            {
                callInfo.OnException(this, (int)type, inflatedData);
            }
        }