/// <summary> /// Remove the member context item. /// </summary> /// <param name="context">The member context to remove from the list.</param> /// <exception cref="System.ArgumentNullException"></exception> public void Remove(Nequeo.Net.IMemberContext context) { if (context == null) { throw new ArgumentNullException("context"); } lock (_lockObject) { try { long index = -1; // For each context item foreach (KeyValuePair <long, Nequeo.Net.IMemberContext> item in _contextList) { // If the contexts are equal. if (item.Value.Equals(context)) { // Get the item index // and stop the search. index = item.Key; break; } } // Remove the item. if (index > -1) { _contextList.Remove(index); } } catch { } } }
/// <summary> /// Remove the member from the member manager. /// </summary> /// <param name="context">The member context to remove.</param> protected virtual void RemoveMember(Nequeo.Net.IMemberContext context) { // Remove the client. if (_timeoutManager != null) { _timeoutManager.Remove(context); } if (_memberContextManager != null) { _memberContextManager.Remove(context); } }
/// <summary> /// Add the member context item. /// </summary> /// <param name="context">The member context to add to the list.</param> /// <exception cref="System.Exception"></exception> /// <exception cref="System.ArgumentNullException"></exception> public void Add(Nequeo.Net.IMemberContext context) { if (context == null) { throw new ArgumentNullException("context"); } lock (_lockObject) { _index++; // Add the item. _contextList.Add(_index, context); } }
/// <summary> /// Add the member context item. /// </summary> /// <param name="context">The member context to add to the list.</param> /// <exception cref="System.Exception"></exception> /// <exception cref="System.ArgumentNullException"></exception> public void Add(Nequeo.Net.IMemberContext context) { if (context == null) { throw new ArgumentNullException("context"); } lock (_lockObject) { try { _indexMember++; // Add the item. _memberList.Add(_indexMember, context); } catch { } } }
/// <summary> /// The action to perform. /// </summary> /// <param name="state">The state object passed.</param> private void ActionMethod(object state) { lock (_lockObject) { // For each context item foreach (KeyValuePair <long, Net.Sockets.IServerContext> item in _contextList) { try { // Get the current server context. Net.Sockets.IServerContext current = item.Value; if (current != null) { // If the context has timed out // then close the connection. if (current.HasTimedOut(_timeout)) { current.Close(); } } } catch { } } // For each context item foreach (KeyValuePair <long, Nequeo.Net.IMemberContext> item in _memberList) { try { // Get the current server context. Nequeo.Net.IMemberContext current = item.Value; if (current != null) { // If the context has timed out // then close the connection. if (current.HasTimedOut(_timeout)) { current.Close(); } } } catch { } } // For each context item foreach (KeyValuePair <long, Nequeo.Net.Provider.ISingleContextBase> item in _singleList) { try { // Get the current server context. Nequeo.Net.Provider.ISingleContextBase current = item.Value; if (current != null) { // If the context has timed out // then close the connection. if (current.HasTimedOut(_timeout)) { current.Close(); } } } catch { } } } }