Exemple #1
0
        public T FindOrCreateActive(ushort eventId, QuicObjectKey key)
        {
            T?value;

            if (eventId == CreateEventId)
            {
                var old = RemoveActiveObject(key);
                if (old != null)
                {
                    inactiveList.Add(old);
                }
                value = ObjectConstructor(key.Pointer, key.ProcessId);
                activeTable.Add(key, value);
            }
            else if (eventId == DestroyedEventId)
            {
                value = RemoveActiveObject(key);
                if (value != null)
                {
                    inactiveList.Add(value);
                }
            }
            else
            {
                value = FindActive(key);
            }

            if (value is null)
            {
                value = ObjectConstructor(key.Pointer, key.ProcessId);
                activeTable.Add(key, value);
            }

            return(value);
        }
Exemple #2
0
        public T FindOrCreateActive(QuicObjectKey key)
        {
            T?value = FindActive(key);

            if (value is null)
            {
                value = ObjectConstructor(key.Pointer, key.ProcessId);
                activeTable.Add(key, value);
            }
            return(value);
        }
Exemple #3
0
 internal QuicConnection FindOrCreateConnection(QuicObjectKey key)
 {
     return(ConnectionSet.FindOrCreateActive(key));
 }
Exemple #4
0
 internal QuicWorker FindOrCreateWorker(QuicObjectKey key)
 {
     return(WorkerSet.FindOrCreateActive(key));
 }
Exemple #5
0
 public T?RemoveActiveObject(QuicObjectKey key) => activeTable.Remove(key, out var value) ? value : null;
Exemple #6
0
 public T?FindActive(QuicObjectKey key) => activeTable.TryGetValue(key, out var value) ? value : null;