diff options
Diffstat (limited to 'OpenSim/Server/Handlers')
-rw-r--r-- | OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 106 |
1 files changed, 98 insertions, 8 deletions
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 30418be..0e6710d 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -145,9 +145,90 @@ 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 | float version = 0f; | ||
178 | |||
179 | float outboundVersion = 0f; | ||
180 | float inboundVersion = 0f; | ||
181 | |||
182 | if (minVersionProvided == 0f) // string version or older | ||
183 | { | ||
184 | // If there is no version in the packet at all we're looking at 0.6 or | ||
185 | // even more ancient. Refuse it. | ||
186 | if(theirVersion == 0f) | ||
187 | { | ||
188 | resp["success"] = OSD.FromBoolean(false); | ||
189 | resp["reason"] = OSD.FromString("Your region is running a old version of opensim no longer supported. Consider updating it"); | ||
190 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp, true); | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | version = theirVersion; | ||
195 | |||
196 | if (version < VersionInfo.SimulationServiceVersionAcceptedMin || | ||
197 | version > VersionInfo.SimulationServiceVersionAcceptedMax ) | ||
198 | { | ||
199 | resp["success"] = OSD.FromBoolean(false); | ||
200 | resp["reason"] = OSD.FromString(String.Format("Your region protocol version is {0} and we accept only {1} - {2}. No version overlap.", 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("Your region provide protocol 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 region protocol 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 versions to use | ||
226 | // This is intentionally inverted. Inbound and Outbound refer to the direction of the transfer. | ||
227 | // Therefore outbound means from the sender to the receier and inbound means from the receiver to the sender. | ||
228 | // So outbound is what we will accept and inbound is what we will send. Confused yet? | ||
229 | outboundVersion = Math.Min(maxVersionProvided, VersionInfo.SimulationServiceVersionAcceptedMax); | ||
230 | inboundVersion = Math.Min(maxVersionRequired, VersionInfo.SimulationServiceVersionSupportedMax); | ||
231 | } | ||
151 | 232 | ||
152 | List<UUID> features = new List<UUID>(); | 233 | List<UUID> features = new List<UUID>(); |
153 | 234 | ||
@@ -163,16 +244,25 @@ namespace OpenSim.Server.Handlers.Simulation | |||
163 | destination.RegionID = regionID; | 244 | destination.RegionID = regionID; |
164 | 245 | ||
165 | string reason; | 246 | string reason; |
166 | string version; | 247 | // We're sending the version numbers down to the local connector to do the varregion check. |
167 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); | 248 | EntityTransferContext ctx = new EntityTransferContext(); |
168 | 249 | ctx.InboundVersion = inboundVersion; | |
169 | responsedata["int_response_code"] = HttpStatusCode.OK; | 250 | ctx.OutboundVersion = outboundVersion; |
251 | if (minVersionProvided == 0f) | ||
252 | { | ||
253 | ctx.InboundVersion = version; | ||
254 | ctx.OutboundVersion = version; | ||
255 | } | ||
170 | 256 | ||
171 | OSDMap resp = new OSDMap(3); | 257 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason); |
172 | 258 | ||
173 | resp["success"] = OSD.FromBoolean(result); | 259 | resp["success"] = OSD.FromBoolean(result); |
174 | resp["reason"] = OSD.FromString(reason); | 260 | resp["reason"] = OSD.FromString(reason); |
175 | resp["version"] = OSD.FromString(version); | 261 | string legacyVersion = String.Format("SIMULATION/{0}", version); |
262 | resp["version"] = OSD.FromString(legacyVersion); | ||
263 | resp["negotiated_inbound_version"] = OSD.FromReal(inboundVersion); | ||
264 | resp["negotiated_outbound_version"] = OSD.FromReal(outboundVersion); | ||
265 | resp["variable_wearables_count_supported"] = OSD.FromBoolean(true); | ||
176 | 266 | ||
177 | OSDArray featuresWanted = new OSDArray(); | 267 | OSDArray featuresWanted = new OSDArray(); |
178 | foreach (UUID feature in features) | 268 | foreach (UUID feature in features) |