aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-01-29 09:12:22 -0800
committerDiva Canto2010-01-29 09:12:22 -0800
commit0c81966c0a8f69474fb542d7b4df1780ef756519 (patch)
tree549973fd8c11ee8dd3eba939eb0605a28c6d2849 /OpenSim
parentFixed broken dll name. (diff)
downloadopensim-SC_OLD-0c81966c0a8f69474fb542d7b4df1780ef756519.zip
opensim-SC_OLD-0c81966c0a8f69474fb542d7b4df1780ef756519.tar.gz
opensim-SC_OLD-0c81966c0a8f69474fb542d7b4df1780ef756519.tar.bz2
opensim-SC_OLD-0c81966c0a8f69474fb542d7b4df1780ef756519.tar.xz
Works for grid login.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs24
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs39
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs29
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs42
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs3
6 files changed, 121 insertions, 22 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 9c9b4b0..353e5bf 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -149,17 +149,19 @@ namespace OpenSim.Framework
149 args["base_folder"] = OSD.FromUUID(BaseFolder); 149 args["base_folder"] = OSD.FromUUID(BaseFolder);
150 args["caps_path"] = OSD.FromString(CapsPath); 150 args["caps_path"] = OSD.FromString(CapsPath);
151 151
152 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); 152 if (ChildrenCapSeeds != null)
153 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
154 { 153 {
155 OSDMap pair = new OSDMap(); 154 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
156 pair["handle"] = OSD.FromString(kvp.Key.ToString()); 155 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
157 pair["seed"] = OSD.FromString(kvp.Value); 156 {
158 childrenSeeds.Add(pair); 157 OSDMap pair = new OSDMap();
158 pair["handle"] = OSD.FromString(kvp.Key.ToString());
159 pair["seed"] = OSD.FromString(kvp.Value);
160 childrenSeeds.Add(pair);
161 }
162 if (ChildrenCapSeeds.Count > 0)
163 args["children_seeds"] = childrenSeeds;
159 } 164 }
160 if (ChildrenCapSeeds.Count > 0)
161 args["children_seeds"] = childrenSeeds;
162
163 args["child"] = OSD.FromBoolean(child); 165 args["child"] = OSD.FromBoolean(child);
164 args["circuit_code"] = OSD.FromString(circuitcode.ToString()); 166 args["circuit_code"] = OSD.FromString(circuitcode.ToString());
165 args["first_name"] = OSD.FromString(firstname); 167 args["first_name"] = OSD.FromString(firstname);
@@ -167,6 +169,7 @@ namespace OpenSim.Framework
167 args["inventory_folder"] = OSD.FromUUID(InventoryFolder); 169 args["inventory_folder"] = OSD.FromUUID(InventoryFolder);
168 args["secure_session_id"] = OSD.FromUUID(SecureSessionID); 170 args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
169 args["session_id"] = OSD.FromUUID(SessionID); 171 args["session_id"] = OSD.FromUUID(SessionID);
172
170 args["service_session_id"] = OSD.FromString(ServiceSessionID); 173 args["service_session_id"] = OSD.FromString(ServiceSessionID);
171 args["start_pos"] = OSD.FromString(startpos.ToString()); 174 args["start_pos"] = OSD.FromString(startpos.ToString());
172 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); 175 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
@@ -250,6 +253,8 @@ namespace OpenSim.Framework
250 } 253 }
251 } 254 }
252 } 255 }
256 else
257 ChildrenCapSeeds = new Dictionary<ulong, string>();
253 258
254 if (args["child"] != null) 259 if (args["child"] != null)
255 child = args["child"].AsBoolean(); 260 child = args["child"].AsBoolean();
@@ -267,6 +272,7 @@ namespace OpenSim.Framework
267 SessionID = args["session_id"].AsUUID(); 272 SessionID = args["session_id"].AsUUID();
268 if (args["service_session_id"] != null) 273 if (args["service_session_id"] != null)
269 ServiceSessionID = args["service_session_id"].AsString(); 274 ServiceSessionID = args["service_session_id"].AsString();
275
270 if (args["start_pos"] != null) 276 if (args["start_pos"] != null)
271 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 277 Vector3.TryParse(args["start_pos"].AsString(), out startpos);
272 278
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 44f1191..ee6cb04 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
97 scene.EventManager.OnNewClient += OnNewClient; 97 scene.EventManager.OnNewClient += OnNewClient;
98 } 98 }
99 99
100 protected void OnNewClient(IClientAPI client) 100 protected virtual void OnNewClient(IClientAPI client)
101 { 101 {
102 client.OnTeleportHomeRequest += TeleportHome; 102 client.OnTeleportHomeRequest += TeleportHome;
103 } 103 }
@@ -268,6 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
268 if (sp.ParentID != (uint)0) 268 if (sp.ParentID != (uint)0)
269 sp.StandUp(); 269 sp.StandUp();
270 270
271 m_log.Debug("XXX HERE 1");
271 if (!sp.ValidateAttachments()) 272 if (!sp.ValidateAttachments())
272 { 273 {
273 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); 274 sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@@ -978,12 +979,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
978 if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) 979 if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle)
979 { 980 {
980 981
982 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
981 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); 983 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
982 agent.BaseFolder = UUID.Zero; 984 agent.BaseFolder = UUID.Zero;
983 agent.InventoryFolder = UUID.Zero; 985 agent.InventoryFolder = UUID.Zero;
984 agent.startpos = new Vector3(128, 128, 70); 986 agent.startpos = new Vector3(128, 128, 70);
985 agent.child = true; 987 agent.child = true;
986 agent.Appearance = sp.Appearance; 988 agent.Appearance = sp.Appearance;
989 if (currentAgentCircuit != null)
990 agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
987 991
988 if (newRegions.Contains(neighbour.RegionHandle)) 992 if (newRegions.Contains(neighbour.RegionHandle))
989 { 993 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 85c2742..fbf8be9 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -85,8 +85,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
85 } 85 }
86 } 86 }
87 87
88 void OnNewClient(IClientAPI client) 88 protected override void OnNewClient(IClientAPI client)
89 { 89 {
90 base.OnNewClient(client);
90 client.OnLogout += new Action<IClientAPI>(OnLogout); 91 client.OnLogout += new Action<IClientAPI>(OnLogout);
91 } 92 }
92 93
@@ -118,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
118 protected override GridRegion GetFinalDestination(GridRegion region) 119 protected override GridRegion GetFinalDestination(GridRegion region)
119 { 120 {
120 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); 121 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID);
121 //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); 122 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
122 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 123 if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
123 { 124 {
124 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); 125 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
@@ -129,7 +130,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
129 130
130 protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) 131 protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
131 { 132 {
132 return true; 133 if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
134 return true;
135
136 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
137 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
138 return true;
139
140 return false;
133 } 141 }
134 142
135 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 143 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
@@ -139,14 +147,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
139 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 147 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
140 { 148 {
141 // this user is going to another grid 149 // this user is going to another grid
142 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); 150 if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
143 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); 151 {
144 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); 152 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
145 if (success) 153 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
146 // Log them out of this grid 154 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
147 m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); 155 if (success)
148 156 // Log them out of this grid
149 return success; 157 m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
158
159 return success;
160 }
161 else
162 {
163 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent does not have a HomeURI address");
164 return false;
165 }
150 } 166 }
151 167
152 return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); 168 return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
@@ -220,6 +236,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
220 236
221 void OnLogout(IClientAPI obj) 237 void OnLogout(IClientAPI obj)
222 { 238 {
239 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName);
223 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); 240 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
224 241
225 if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) 242 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 318ce85..c90dd6f 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -109,6 +109,8 @@ namespace OpenSim.Server.Handlers.Grid
109 case "get_fallback_regions": 109 case "get_fallback_regions":
110 return GetFallbackRegions(request); 110 return GetFallbackRegions(request);
111 111
112 case "get_region_flags":
113 return GetRegionFlags(request);
112 } 114 }
113 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); 115 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
114 } 116 }
@@ -481,6 +483,33 @@ namespace OpenSim.Server.Handlers.Grid
481 return encoding.GetBytes(xmlString); 483 return encoding.GetBytes(xmlString);
482 } 484 }
483 485
486 byte[] GetRegionFlags(Dictionary<string, object> request)
487 {
488 UUID scopeID = UUID.Zero;
489 if (request.ContainsKey("SCOPEID"))
490 UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
491 else
492 m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
493
494 UUID regionID = UUID.Zero;
495 if (request.ContainsKey("REGIONID"))
496 UUID.TryParse(request["REGIONID"].ToString(), out regionID);
497 else
498 m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
499
500 int flags = m_GridService.GetRegionFlags(scopeID, regionID);
501 // m_log.DebugFormat("[GRID HANDLER]: flags for region {0}: {1}", regionID, flags);
502
503 Dictionary<string, object> result = new Dictionary<string, object>();
504 result["result"] = flags.ToString();
505
506 string xmlString = ServerUtils.BuildXmlResponse(result);
507 //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
508 UTF8Encoding encoding = new UTF8Encoding();
509 return encoding.GetBytes(xmlString);
510 }
511
512
484 #endregion 513 #endregion
485 514
486 #region Misc 515 #region Misc
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index a1ca58e..7c8a3e2 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -564,7 +564,47 @@ namespace OpenSim.Services.Connectors
564 564
565 public int GetRegionFlags(UUID scopeID, UUID regionID) 565 public int GetRegionFlags(UUID scopeID, UUID regionID)
566 { 566 {
567 return 0; 567 Dictionary<string, object> sendData = new Dictionary<string, object>();
568
569 sendData["SCOPEID"] = scopeID.ToString();
570 sendData["REGIONID"] = regionID.ToString();
571
572 sendData["METHOD"] = "get_region_flags";
573
574 string reply = string.Empty;
575 try
576 {
577 reply = SynchronousRestFormsRequester.MakeRequest("POST",
578 m_ServerURI + "/grid",
579 ServerUtils.BuildQueryString(sendData));
580 }
581 catch (Exception e)
582 {
583 m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
584 return -1;
585 }
586
587 int flags = -1;
588
589 if (reply != string.Empty)
590 {
591 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
592
593 if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
594 {
595 Int32.TryParse((string)replyData["result"], out flags);
596 //else
597 // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received wrong type {2}",
598 // scopeID, regionID, replyData["result"].GetType());
599 }
600 else
601 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags {0}, {1} received null response",
602 scopeID, regionID);
603 }
604 else
605 m_log.DebugFormat("[GRID CONNECTOR]: GetRegionFlags received null reply");
606
607 return flags;
568 } 608 }
569 609
570 #endregion 610 #endregion
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index e2ab179..d3be1a8 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -105,6 +105,8 @@ namespace OpenSim.Services.Connectors.Simulation
105 105
106 // Fill it in 106 // Fill it in
107 OSDMap args = PackCreateAgentArguments(aCircuit, destination, flags); 107 OSDMap args = PackCreateAgentArguments(aCircuit, destination, flags);
108 if (args == null)
109 return false;
108 110
109 string strBuffer = ""; 111 string strBuffer = "";
110 byte[] buffer = new byte[1]; 112 byte[] buffer = new byte[1];
@@ -210,6 +212,7 @@ namespace OpenSim.Services.Connectors.Simulation
210 catch (Exception e) 212 catch (Exception e)
211 { 213 {
212 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); 214 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
215 return null;
213 } 216 }
214 // Add the input arguments 217 // Add the input arguments
215 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 218 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());