diff options
author | John Hurliman | 2009-10-13 16:53:19 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-13 16:53:19 -0700 |
commit | 395a8680c3633ca131e7481f765517311ef51710 (patch) | |
tree | e9c3634c3c37e6595b7743da88b236c12fc81422 /OpenSim/Framework | |
parent | * Rewrote ClientManager to remove Lindenisms from OpenSim core, improve perfo... (diff) | |
download | opensim-SC-395a8680c3633ca131e7481f765517311ef51710.zip opensim-SC-395a8680c3633ca131e7481f765517311ef51710.tar.gz opensim-SC-395a8680c3633ca131e7481f765517311ef51710.tar.bz2 opensim-SC-395a8680c3633ca131e7481f765517311ef51710.tar.xz |
* Fixed a bug where clients were being added to ClientManager twice
* Changed the ClientManager interface to reduce potential errors with duplicate or mismatched keys
* Added IClientAPI.RemoteEndPoint, which can (hopefully) eventually replace IClientAPI.CircuitCode
* Changed the order of operations during client shutdown
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/ClientManager.cs | 22 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index 4edfabe..aefe425 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs | |||
@@ -97,19 +97,17 @@ namespace OpenSim.Framework | |||
97 | /// Add a client reference to the collection if it does not already | 97 | /// Add a client reference to the collection if it does not already |
98 | /// exist | 98 | /// exist |
99 | /// </summary> | 99 | /// </summary> |
100 | /// <param name="key">UUID of the client</param> | ||
101 | /// <param name="key2">Remote endpoint of the client</param> | ||
102 | /// <param name="value">Reference to the client object</param> | 100 | /// <param name="value">Reference to the client object</param> |
103 | /// <returns>True if the client reference was successfully added, | 101 | /// <returns>True if the client reference was successfully added, |
104 | /// otherwise false if the given key already existed in the collection</returns> | 102 | /// otherwise false if the given key already existed in the collection</returns> |
105 | public bool Add(UUID key, IPEndPoint key2, IClientAPI value) | 103 | public bool Add(IClientAPI value) |
106 | { | 104 | { |
107 | lock (m_writeLock) | 105 | lock (m_writeLock) |
108 | { | 106 | { |
109 | if (!m_dict.ContainsKey(key) && !m_dict2.ContainsKey(key2)) | 107 | if (!m_dict.ContainsKey(value.AgentId) && !m_dict2.ContainsKey(value.RemoteEndPoint)) |
110 | { | 108 | { |
111 | m_dict = m_dict.Add(key, value); | 109 | m_dict = m_dict.Add(value.AgentId, value); |
112 | m_dict2 = m_dict2.Add(key2, value); | 110 | m_dict2 = m_dict2.Add(value.RemoteEndPoint, value); |
113 | 111 | ||
114 | return true; | 112 | return true; |
115 | } | 113 | } |
@@ -123,14 +121,16 @@ namespace OpenSim.Framework | |||
123 | /// <summary> | 121 | /// <summary> |
124 | /// Remove a client from the collection | 122 | /// Remove a client from the collection |
125 | /// </summary> | 123 | /// </summary> |
126 | /// <param name="key">UUID of the client</param> | 124 | /// <param name="value">Reference to the client object</param> |
127 | /// <param name="key2">Remote endpoint of the client</param> | 125 | public void Remove(IClientAPI value) |
128 | public void Remove(UUID key, IPEndPoint key2) | ||
129 | { | 126 | { |
130 | lock (m_writeLock) | 127 | lock (m_writeLock) |
131 | { | 128 | { |
132 | m_dict = m_dict.Delete(key); | 129 | if (m_dict.ContainsKey(value.AgentId)) |
133 | m_dict2 = m_dict2.Delete(key2); | 130 | m_dict = m_dict.Delete(value.AgentId); |
131 | |||
132 | if (m_dict2.ContainsKey(value.RemoteEndPoint)) | ||
133 | m_dict2 = m_dict2.Delete(value.RemoteEndPoint); | ||
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 99ea0d5..29846f5 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -561,6 +561,8 @@ namespace OpenSim.Framework | |||
561 | // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] | 561 | // [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] |
562 | uint CircuitCode { get; } | 562 | uint CircuitCode { get; } |
563 | 563 | ||
564 | IPEndPoint RemoteEndPoint { get; } | ||
565 | |||
564 | event GenericMessage OnGenericMessage; | 566 | event GenericMessage OnGenericMessage; |
565 | 567 | ||
566 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] | 568 | // [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] |