/// <summary> /// Default constructor /// </summary> public WSAgent(WebSockets server, TokenBucket parentThrottle, ThrottleRates rates, UUID agentID, UUID sessionID, Socket socket, bool isChildAgent) { m_id = agentID; m_server = server; m_interestList = new InterestList(this, 200); IsChildPresence = isChildAgent; m_localID = m_server.Scene.CreateLocalID(); //TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE); SessionID = sessionID; Socket = socket; // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { ThrottleCategory type = (ThrottleCategory)i; // Initialize the message outboxes, where messages sit while they are waiting for tokens m_messageOutboxes[i] = new LocklessQueue <OutgoingMessage>(); // Initialize the token buckets that control the throttling for each category m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type)); } // Initialize this to a sane value to prevent early disconnects TickLastMessageReceived = Util.TickCount(); }
public WebSocketServer(WebSockets server) { m_server = server; m_receiveBufferSize = MTU; m_readPool = new ObjectPool <SocketAsyncEventArgs>(0, CreateSocketArgs); // TODO: Support throttle config m_throttleRates = new ThrottleRates(MTU, null); m_throttle = new TokenBucket(null, m_throttleRates.SceneTotalLimit, m_throttleRates.SceneTotal); }
/// <summary> /// Default constructor /// </summary> public WSAgent(WebSockets server, TokenBucket parentThrottle, ThrottleRates rates, UUID agentID, UUID sessionID, Socket socket, bool isChildAgent) { m_id = agentID; m_server = server; m_interestList = new InterestList(this, 200); IsChildPresence = isChildAgent; m_localID = m_server.Scene.CreateLocalID(); //TextureEntry = new Primitive.TextureEntry(DEFAULT_AVATAR_TEXTURE); SessionID = sessionID; Socket = socket; // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttle = new TokenBucket(parentThrottle, rates.ClientTotalLimit, rates.ClientTotal); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { ThrottleCategory type = (ThrottleCategory)i; // Initialize the message outboxes, where messages sit while they are waiting for tokens m_messageOutboxes[i] = new LocklessQueue<OutgoingMessage>(); // Initialize the token buckets that control the throttling for each category m_throttleCategories[i] = new TokenBucket(m_throttle, rates.GetLimit(type), rates.GetRate(type)); } // Initialize this to a sane value to prevent early disconnects TickLastMessageReceived = Environment.TickCount & Int32.MaxValue; }
public WebSocketServer(WebSockets server) { m_server = server; m_receiveBufferSize = MTU; m_readPool = new ObjectPool<SocketAsyncEventArgs>(0, CreateSocketArgs); // TODO: Support throttle config m_throttleRates = new ThrottleRates(MTU, null); m_throttle = new TokenBucket(null, m_throttleRates.SceneTotalLimit, m_throttleRates.SceneTotal); }