예제 #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);
        }
예제 #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);
        }
예제 #3
0
 internal QuicConnection FindOrCreateConnection(QuicObjectKey key)
 {
     return(ConnectionSet.FindOrCreateActive(key));
 }
예제 #4
0
 internal QuicWorker FindOrCreateWorker(QuicObjectKey key)
 {
     return(WorkerSet.FindOrCreateActive(key));
 }
예제 #5
0
 public T?RemoveActiveObject(QuicObjectKey key) => activeTable.Remove(key, out var value) ? value : null;
예제 #6
0
 public T?FindActive(QuicObjectKey key) => activeTable.TryGetValue(key, out var value) ? value : null;