private void HandleSubscriptionRequests() { if (this.m_queuedSubscriptions.Count > 0) { long elapsedMilliseconds = this.m_stopWatch.ElapsedMilliseconds; this.m_presenceSubscriptionBalance = Math.Min((float)0f, (float)(this.m_presenceSubscriptionBalance + ((elapsedMilliseconds - this.m_lastPresenceSubscriptionSent) * 0.003333333f))); this.m_lastPresenceSubscriptionSent = elapsedMilliseconds; List <EntityId> list = new List <EntityId>(); foreach (EntityId id in this.m_queuedSubscriptions) { if ((this.m_presenceSubscriptionBalance - 1f) < -100f) { break; } PresenceRefCountObject obj2 = this.m_presenceSubscriptions[id]; SubscribeRequest message = new SubscribeRequest(); message.SetObjectId(ChannelAPI.GetNextObjectId()); message.SetEntityId(id); obj2.objectId = message.ObjectId; base.m_battleNet.Channel.AddActiveChannel(message.ObjectId, new ChannelAPI.ChannelReferenceObject(id, ChannelAPI.ChannelType.PRESENCE_CHANNEL)); base.m_rpcConnection.QueueRequest(this.m_presenceService.Id, 1, message, new RPCContextDelegate(this.PresenceSubscribeCallback), 0); this.m_presenceSubscriptionBalance--; list.Add(id); } foreach (EntityId id2 in list) { this.m_queuedSubscriptions.Remove(id2); } } }
private void HandleSubscriptionRequests() { if (this.m_queuedSubscriptions.Count > 0) { long elapsedMilliseconds = this.m_stopWatch.ElapsedMilliseconds; this.m_presenceSubscriptionBalance = Math.Min(0f, this.m_presenceSubscriptionBalance + (float)(elapsedMilliseconds - this.m_lastPresenceSubscriptionSent) * 0.00333333341f); this.m_lastPresenceSubscriptionSent = elapsedMilliseconds; List <bnet.protocol.EntityId> list = new List <bnet.protocol.EntityId>(); foreach (bnet.protocol.EntityId entityId in this.m_queuedSubscriptions) { if (this.m_presenceSubscriptionBalance - 1f < -100f) { break; } PresenceAPI.PresenceRefCountObject presenceRefCountObject = this.m_presenceSubscriptions[entityId]; SubscribeRequest subscribeRequest = new SubscribeRequest(); subscribeRequest.SetObjectId(ChannelAPI.GetNextObjectId()); subscribeRequest.SetEntityId(entityId); presenceRefCountObject.objectId = subscribeRequest.ObjectId; this.m_battleNet.Channel.AddActiveChannel(subscribeRequest.ObjectId, new ChannelAPI.ChannelReferenceObject(entityId, ChannelAPI.ChannelType.PRESENCE_CHANNEL)); this.m_rpcConnection.QueueRequest(this.m_presenceService.Id, 1u, subscribeRequest, new RPCContextDelegate(this.PresenceSubscribeCallback), 0u); this.m_presenceSubscriptionBalance -= 1f; list.Add(entityId); } foreach (bnet.protocol.EntityId item in list) { this.m_queuedSubscriptions.Remove(item); } } }
private void HandleSubscriptionRequests() { if (this.m_queuedSubscriptions.get_Count() > 0) { long elapsedMilliseconds = this.m_stopWatch.get_ElapsedMilliseconds(); this.m_presenceSubscriptionBalance = Math.Min(0f, this.m_presenceSubscriptionBalance + (float)(elapsedMilliseconds - this.m_lastPresenceSubscriptionSent) * 0.00333333341f); this.m_lastPresenceSubscriptionSent = elapsedMilliseconds; List <bnet.protocol.EntityId> list = new List <bnet.protocol.EntityId>(); using (HashSet <bnet.protocol.EntityId> .Enumerator enumerator = this.m_queuedSubscriptions.GetEnumerator()) { while (enumerator.MoveNext()) { bnet.protocol.EntityId current = enumerator.get_Current(); if (this.m_presenceSubscriptionBalance - 1f < -100f) { break; } PresenceAPI.PresenceRefCountObject presenceRefCountObject = this.m_presenceSubscriptions[current]; SubscribeRequest subscribeRequest = new SubscribeRequest(); subscribeRequest.SetObjectId(ChannelAPI.GetNextObjectId()); subscribeRequest.SetEntityId(current); presenceRefCountObject.objectId = subscribeRequest.ObjectId; this.m_battleNet.Channel.AddActiveChannel(subscribeRequest.ObjectId, new ChannelAPI.ChannelReferenceObject(current, ChannelAPI.ChannelType.PRESENCE_CHANNEL)); this.m_rpcConnection.QueueRequest(this.m_presenceService.Id, 1u, subscribeRequest, new RPCContextDelegate(this.PresenceSubscribeCallback), 0u); this.m_presenceSubscriptionBalance -= 1f; list.Add(current); } } using (List <bnet.protocol.EntityId> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { bnet.protocol.EntityId current2 = enumerator2.get_Current(); this.m_queuedSubscriptions.Remove(current2); } } } }