diff options
Diffstat (limited to 'OpenSim/Server')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 103 |
1 files changed, 94 insertions, 9 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 8b4518c..e0fa799 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -145,9 +145,96 @@ namespace OpenSim.Server.Handlers.Simulation | |||
145 | if (args.ContainsKey("agent_home_uri")) | 145 | if (args.ContainsKey("agent_home_uri")) |
146 | agentHomeURI = args["agent_home_uri"].AsString(); | 146 | agentHomeURI = args["agent_home_uri"].AsString(); |
147 | 147 | ||
148 | string theirVersion = string.Empty; | 148 | // Decode the legacy (string) version and extract the number |
149 | float theirVersion = 0f; | ||
149 | if (args.ContainsKey("my_version")) | 150 | if (args.ContainsKey("my_version")) |
150 | theirVersion = args["my_version"].AsString(); | 151 | { |
152 | string theirVersionStr = args["my_version"].AsString(); | ||
153 | string[] parts = theirVersionStr.Split(new char[] {'/'}); | ||
154 | if (parts.Length > 1) | ||
155 | theirVersion = float.Parse(parts[1]); | ||
156 | } | ||
157 | |||
158 | // Decode the new versioning data | ||
159 | float minVersionRequired = 0f; | ||
160 | float maxVersionRequired = 0f; | ||
161 | float minVersionProvided = 0f; | ||
162 | float maxVersionProvided = 0f; | ||
163 | |||
164 | if (args.ContainsKey("simulation_service_supported_min")) | ||
165 | minVersionProvided = (float)args["simulation_service_supported_min"].AsReal(); | ||
166 | if (args.ContainsKey("simulation_service_supported_max")) | ||
167 | maxVersionProvided = (float)args["simulation_service_supported_max"].AsReal(); | ||
168 | |||
169 | if (args.ContainsKey("simulation_service_accepted_min")) | ||
170 | minVersionRequired = (float)args["simulation_service_accepted_min"].AsReal(); | ||
171 | if (args.ContainsKey("simulation_service_accepted_max")) | ||
172 | maxVersionRequired = (float)args["simulation_service_accepted_max"].AsReal(); | ||
173 | |||
174 | responsedata["int_response_code"] = HttpStatusCode.OK; | ||
175 | OSDMap resp = new OSDMap(3); | ||
176 | |||
177 | |||
178 | // If there is no version in the packet at all we're looking at 0.6 or | ||
179 | // even more ancient. Refuse it. | ||
180 | if (minVersionProvided == 0f && theirVersion == 0f) // 0.6 or earlier | ||
181 | { | ||
182 | resp["success"] = OSD.FromBoolean(false); | ||
183 | resp["reason"] = OSD.FromString("Version not supported"); | ||
184 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | float version; | ||
189 | |||
190 | if (minVersionProvided == 0f) // Legacy version | ||
191 | { | ||
192 | if (theirVersion >= VersionInfo.SimulationServiceVersionAcceptedMin && | ||
193 | theirVersion <= VersionInfo.SimulationServiceVersionAcceptedMax) | ||
194 | { | ||
195 | version = Math.Max(theirVersion, VersionInfo.SimulationServiceVersionAcceptedMax); | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | resp["success"] = OSD.FromBoolean(false); | ||
200 | resp["reason"] = OSD.FromString(String.Format("Your version is {0} and we accept only {1} - {2}", theirVersion, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); | ||
201 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
202 | return; | ||
203 | } | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | // Test for no overlap | ||
208 | if (minVersionProvided > VersionInfo.SimulationServiceVersionAcceptedMax || | ||
209 | maxVersionProvided < VersionInfo.SimulationServiceVersionAcceptedMin) | ||
210 | { | ||
211 | resp["success"] = OSD.FromBoolean(false); | ||
212 | resp["reason"] = OSD.FromString(String.Format("You provide versions {0} - {1} and we accept only {2} - {3}. No version overlap.", minVersionProvided, maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax)); | ||
213 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
214 | return; | ||
215 | } | ||
216 | if (minVersionRequired > VersionInfo.SimulationServiceVersionSupportedMax || | ||
217 | maxVersionRequired < VersionInfo.SimulationServiceVersionSupportedMin) | ||
218 | { | ||
219 | resp["success"] = OSD.FromBoolean(false); | ||
220 | resp["reason"] = OSD.FromString(String.Format("You require versions {0} - {1} and we provide only {2} - {3}. No version overlap.", minVersionRequired, maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); | ||
221 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | // Determine version to use | ||
226 | version = Math.Max(Math.Max(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax), Math.Max(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax)); | ||
227 | if (version < VersionInfo.SimulationServiceVersionAcceptedMin || | ||
228 | version > VersionInfo.SimulationServiceVersionAcceptedMax || | ||
229 | version < VersionInfo.SimulationServiceVersionSupportedMin || | ||
230 | version > VersionInfo.SimulationServiceVersionSupportedMax) | ||
231 | { | ||
232 | resp["success"] = OSD.FromBoolean(false); | ||
233 | resp["reason"] = OSD.FromString(String.Format("The protocol version we determined, {0}, is incompatible with the version windows, {1} - {2} and {3} - {4}. No version overlap.", version, VersionInfo.SimulationServiceVersionAcceptedMin, VersionInfo.SimulationServiceVersionAcceptedMax, VersionInfo.SimulationServiceVersionSupportedMin, VersionInfo.SimulationServiceVersionSupportedMax)); | ||
234 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
235 | return; | ||
236 | } | ||
237 | } | ||
151 | 238 | ||
152 | List<UUID> features = new List<UUID>(); | 239 | List<UUID> features = new List<UUID>(); |
153 | 240 | ||
@@ -163,16 +250,14 @@ namespace OpenSim.Server.Handlers.Simulation | |||
163 | destination.RegionID = regionID; | 250 | destination.RegionID = regionID; |
164 | 251 | ||
165 | string reason; | 252 | string reason; |
166 | string version; | 253 | float dummyVersion; |
167 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); | 254 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, out dummyVersion, out reason); |
168 | |||
169 | responsedata["int_response_code"] = HttpStatusCode.OK; | ||
170 | |||
171 | OSDMap resp = new OSDMap(3); | ||
172 | 255 | ||
173 | resp["success"] = OSD.FromBoolean(result); | 256 | resp["success"] = OSD.FromBoolean(result); |
174 | resp["reason"] = OSD.FromString(reason); | 257 | resp["reason"] = OSD.FromString(reason); |
175 | resp["version"] = OSD.FromString(version); | 258 | string legacyVersion = String.Format("SIMULATION/{0}", version); |
259 | resp["version"] = OSD.FromString(legacyVersion); | ||
260 | resp["negotiated_version"] = OSD.FromReal(version); | ||
176 | resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); | 261 | resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); |
177 | 262 | ||
178 | OSDArray featuresWanted = new OSDArray(); | 263 | OSDArray featuresWanted = new OSDArray(); |