aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Simulation
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Services/Connectors/Simulation
parentAdd a build script. (diff)
downloadopensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs71
1 files changed, 41 insertions, 30 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index cea870b..a4ca2d3 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Services.Connectors.Simulation
50 50
51 // we use this dictionary to track the pending updateagent requests, maps URI --> position update 51 // we use this dictionary to track the pending updateagent requests, maps URI --> position update
52 private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>(); 52 private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>();
53 53
54 //private GridRegion m_Region; 54 //private GridRegion m_Region;
55 55
56 public SimulationServiceConnector() 56 public SimulationServiceConnector()
@@ -98,29 +98,32 @@ namespace OpenSim.Services.Connectors.Simulation
98 args["teleport_flags"] = OSD.FromString(flags.ToString()); 98 args["teleport_flags"] = OSD.FromString(flags.ToString());
99 } 99 }
100 100
101 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 101 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason)
102 { 102 {
103 string tmp = String.Empty; 103 string tmp = String.Empty;
104 return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason); 104 return CreateAgent(source, destination, aCircuit, flags, ctx, out tmp, out reason);
105 } 105 }
106 106
107 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) 107 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason)
108 { 108 {
109 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
110 reason = String.Empty; 109 reason = String.Empty;
111 myipaddress = String.Empty; 110 myipaddress = String.Empty;
112 111
113 if (destination == null) 112 if (destination == null)
114 { 113 {
115 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); 114 reason = "Destination not found";
115 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Create agent destination is null");
116 return false; 116 return false;
117 } 117 }
118 118
119 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
120
119 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; 121 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
120 122
121 try 123 try
122 { 124 {
123 OSDMap args = aCircuit.PackAgentCircuitData(); 125 OSDMap args = aCircuit.PackAgentCircuitData(ctx);
126 args["context"] = ctx.Pack();
124 PackData(args, source, aCircuit, destination, flags); 127 PackData(args, source, aCircuit, destination, flags);
125 128
126 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); 129 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
@@ -134,7 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation
134 myipaddress = data["your_ip"].AsString(); 137 myipaddress = data["your_ip"].AsString();
135 return success; 138 return success;
136 } 139 }
137 140
138 // Try the old version, uncompressed 141 // Try the old version, uncompressed
139 result = WebUtil.PostToService(uri, args, 30000, false); 142 result = WebUtil.PostToService(uri, args, 30000, false);
140 143
@@ -152,10 +155,10 @@ namespace OpenSim.Services.Connectors.Simulation
152 return success; 155 return success;
153 } 156 }
154 } 157 }
155 158
156 m_log.WarnFormat( 159 m_log.WarnFormat(
157 "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}", 160 "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}",
158 aCircuit.firstname, aCircuit.lastname, destination.RegionName); 161 aCircuit.firstname, aCircuit.lastname, destination.RegionName);
159 reason = result["Message"] != null ? result["Message"].AsString() : "error"; 162 reason = result["Message"] != null ? result["Message"].AsString() : "error";
160 return false; 163 return false;
161 } 164 }
@@ -171,9 +174,9 @@ namespace OpenSim.Services.Connectors.Simulation
171 /// <summary> 174 /// <summary>
172 /// Send complete data about an agent in this region to a neighbor 175 /// Send complete data about an agent in this region to a neighbor
173 /// </summary> 176 /// </summary>
174 public bool UpdateAgent(GridRegion destination, AgentData data) 177 public bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx)
175 { 178 {
176 return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds 179 return UpdateAgent(destination, (IAgentData)data, ctx, 200000); // yes, 200 seconds
177 } 180 }
178 181
179 private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); 182 private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>();
@@ -199,8 +202,8 @@ namespace OpenSim.Services.Connectors.Simulation
199 { 202 {
200 if (m_updateAgentQueue.ContainsKey(uri)) 203 if (m_updateAgentQueue.ContainsKey(uri))
201 { 204 {
202 // Another thread is already handling 205 // Another thread is already handling
203 // updates for this simulator, just update 206 // updates for this simulator, just update
204 // the position and return, overwrites are 207 // the position and return, overwrites are
205 // not a problem since we only care about the 208 // not a problem since we only care about the
206 // last update anyway 209 // last update anyway
@@ -234,7 +237,8 @@ namespace OpenSim.Services.Connectors.Simulation
234 } 237 }
235 } 238 }
236 239
237 success = UpdateAgent(destination, (IAgentData)pos, 10000); 240 EntityTransferContext ctx = new EntityTransferContext(); // Dummy, not needed for position
241 success = UpdateAgent(destination, (IAgentData)pos, ctx, 10000);
238 } 242 }
239 // we get here iff success == false 243 // we get here iff success == false
240 // blacklist sim for 2 minutes 244 // blacklist sim for 2 minutes
@@ -249,7 +253,7 @@ namespace OpenSim.Services.Connectors.Simulation
249 /// <summary> 253 /// <summary>
250 /// This is the worker function to send AgentData to a neighbor region 254 /// This is the worker function to send AgentData to a neighbor region
251 /// </summary> 255 /// </summary>
252 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) 256 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, EntityTransferContext ctx, int timeout)
253 { 257 {
254 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI); 258 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI);
255 259
@@ -258,12 +262,13 @@ namespace OpenSim.Services.Connectors.Simulation
258 262
259 try 263 try
260 { 264 {
261 OSDMap args = cAgentData.Pack(); 265 OSDMap args = cAgentData.Pack(ctx);
262 266
263 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 267 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
264 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 268 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
265 args["destination_name"] = OSD.FromString(destination.RegionName); 269 args["destination_name"] = OSD.FromString(destination.RegionName);
266 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 270 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
271 args["context"] = ctx.Pack();
267 272
268 OSDMap result = WebUtil.PutToServiceCompressed(uri, args, timeout); 273 OSDMap result = WebUtil.PutToServiceCompressed(uri, args, timeout);
269 if (result["Success"].AsBoolean()) 274 if (result["Success"].AsBoolean())
@@ -284,20 +289,19 @@ namespace OpenSim.Services.Connectors.Simulation
284 289
285 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason) 290 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason)
286 { 291 {
292 Culture.SetCurrentCulture();
293
287 reason = "Failed to contact destination"; 294 reason = "Failed to contact destination";
288 295
289 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); 296 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
290 297
291 IPEndPoint ext = destination.ExternalEndPoint;
292 if (ext == null) return false;
293
294 // Eventually, we want to use a caps url instead of the agentID 298 // Eventually, we want to use a caps url instead of the agentID
295 string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; 299 string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/";
296 300
297 OSDMap request = new OSDMap(); 301 OSDMap request = new OSDMap();
298 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); 302 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
299 request.Add("position", OSD.FromString(position.ToString())); 303 request.Add("position", OSD.FromString(position.ToString()));
300 // To those who still understad this field, we're telling them 304 // To those who still understad this field, we're telling them
301 // the lowest version just to be safe 305 // the lowest version just to be safe
302 request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin))); 306 request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin)));
303 // New simulation service negotiation 307 // New simulation service negotiation
@@ -306,6 +310,8 @@ namespace OpenSim.Services.Connectors.Simulation
306 request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin)); 310 request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin));
307 request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax)); 311 request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax));
308 312
313 request.Add("context", ctx.Pack());
314
309 OSDArray features = new OSDArray(); 315 OSDArray features = new OSDArray();
310 foreach (UUID feature in featuresAvailable) 316 foreach (UUID feature in featuresAvailable)
311 features.Add(OSD.FromString(feature.ToString())); 317 features.Add(OSD.FromString(feature.ToString()));
@@ -325,7 +331,7 @@ namespace OpenSim.Services.Connectors.Simulation
325 331
326 // FIXME: If there is a _Result map then it's the success key here that indicates the true success 332 // FIXME: If there is a _Result map then it's the success key here that indicates the true success
327 // or failure, not the sibling result node. 333 // or failure, not the sibling result node.
328 success = data["success"]; 334 success = data["success"].AsBoolean();
329 335
330 reason = data["reason"].AsString(); 336 reason = data["reason"].AsString();
331 // We will need to plumb this and start sing the outbound version as well 337 // We will need to plumb this and start sing the outbound version as well
@@ -345,8 +351,6 @@ namespace OpenSim.Services.Connectors.Simulation
345 ctx.OutboundVersion = float.Parse(parts[1]); 351 ctx.OutboundVersion = float.Parse(parts[1]);
346 } 352 }
347 } 353 }
348 if (data.ContainsKey("variable_wearables_count_supported"))
349 ctx.VariableWearablesSupported = true;
350 354
351 m_log.DebugFormat( 355 m_log.DebugFormat(
352 "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}", 356 "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}",
@@ -367,7 +371,7 @@ namespace OpenSim.Services.Connectors.Simulation
367 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); 371 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
368 return true; 372 return true;
369 } 373 }
370 374
371 reason = result["Message"]; 375 reason = result["Message"];
372 } 376 }
373 else 377 else
@@ -379,7 +383,6 @@ namespace OpenSim.Services.Connectors.Simulation
379 return false; 383 return false;
380 } 384 }
381 385
382
383 featuresAvailable.Clear(); 386 featuresAvailable.Clear();
384 387
385 if (result.ContainsKey("features")) 388 if (result.ContainsKey("features"))
@@ -390,13 +393,21 @@ namespace OpenSim.Services.Connectors.Simulation
390 featuresAvailable.Add(new UUID(o.AsString())); 393 featuresAvailable.Add(new UUID(o.AsString()));
391 } 394 }
392 395
396 // Version stuff
397 if (ctx.OutboundVersion < 0.5)
398 ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES;
399 else if (ctx.OutboundVersion < 0.6)
400 ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES + 1;
401 else
402 ctx.WearablesCount = -1; // send all (just in case..)
403
393 return success; 404 return success;
394 } 405 }
395 catch (Exception e) 406 catch (Exception e)
396 { 407 {
397 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString()); 408 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString());
398 } 409 }
399 410
400 return false; 411 return false;
401 } 412 }
402 413
@@ -414,7 +425,7 @@ namespace OpenSim.Services.Connectors.Simulation
414 { 425 {
415 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString()); 426 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString());
416 } 427 }
417 428
418 return true; 429 return true;
419 } 430 }
420 431