Example #1
0
        LotAllocation Remove(uint lotId)
        {
            LotAllocation removed = null;

            if ((lotId & 0x40000000) > 0)
            {
                Matchmaker.RemoveJobLot(lotId & 0x3FFFFFFF);
            }
            _Locks.TryRemove(lotId, out removed);
            return(removed);
        }
Example #2
0
        public void OnTransferClaimResponse(TransferClaimResponse response)
        {
            if (response.Type != Protocol.Gluon.Model.ClaimType.LOT)
            {
                return;
            }

            uint?location;

            if (response.ClaimId != 0)
            {
                using (var da = DAFactory.Get())
                {
                    location = da.Lots.Get(response.EntityId)?.location;
                }
            }
            else
            {
                location = (uint)response.EntityId;
            }
            if (location == null)
            {
                return;
            }

            var allocation = Get(location.Value);

            lock (allocation)
            {
                allocation.OnTransferClaimResponse(response);
                if (allocation.State == LotAllocationState.FAILED)
                {
                    //Failed, remove
                    LotAllocation removedAllocation = Remove(location.Value);
                }
            }

            //Touches the db so do this outside of the lock
            if (allocation.State == LotAllocationState.FAILED)
            {
                allocation.Free();
            }
        }