void RemoveInflightData(NSUrlSessionTask task, bool cancel = true)
        {
            lock (inflightRequestsLock) {
                if (inflightRequests.TryGetValue(task, out var data))
                {
                    if (cancel)
                    {
                        data.CancellationTokenSource.Cancel();
                    }
                    data.Dispose();
                    inflightRequests.Remove(task);
                }
#if !MONOMAC && !__WATCHOS__
                // do we need to be notified? If we have not inflightData, we do not
                if (inflightRequests.Count == 0)
                {
                    RemoveNotification();
                }
#endif
            }

            if (cancel)
            {
                task?.Cancel();
            }

            task?.Dispose();
        }
        void RemoveInflightData(NSUrlSessionTask task, bool cancel = true)
        {
            lock (inflightRequestsLock)
                inflightRequests.Remove(task);

            if (cancel)
            {
                task?.Cancel();
            }

            task?.Dispose();
        }
Beispiel #3
0
        void RemoveInflightData(NSUrlSessionTask task, bool cancel = true)
        {
            InflightData inflight;

            lock (inflightRequestsLock)
                if (inflightRequests.TryGetValue(task, out inflight))
                {
                    inflightRequests.Remove(task);
                }

            if (cancel)
            {
                task?.Cancel();
            }

            task?.Dispose();
        }
Beispiel #4
0
        void RemoveInflightData(NSUrlSessionTask task, bool cancel = true)
        {
            lock (inflightRequestsLock) {
                inflightRequests.Remove(task);
#if !MONOMAC && !MONOTOUCH_WATCH
                // do we need to be notified? If we have not inflightData, we do not
                if (inflightRequests.Count == 0)
                {
                    RemoveNotification();
                }
#endif
            }

            if (cancel)
            {
                task?.Cancel();
            }

            task?.Dispose();
        }