aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim.RegionServer')
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs61
-rw-r--r--OpenSim.RegionServer/SimClient.cs32
-rw-r--r--OpenSim.RegionServer/world/AvatarUpdate.cs3
-rw-r--r--OpenSim.RegionServer/world/World.cs29
4 files changed, 93 insertions, 32 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 8c93128..f10ca34 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -48,7 +48,7 @@ using OpenSim.Framework.Console;
48using OpenSim.Physics.Manager; 48using OpenSim.Physics.Manager;
49using Nwc.XmlRpc; 49using Nwc.XmlRpc;
50using OpenSim.Servers; 50using OpenSim.Servers;
51using OpenSim.GenericConfig; 51using OpenSim.GenericConfig;
52 52
53namespace OpenSim 53namespace OpenSim
54{ 54{
@@ -164,6 +164,18 @@ namespace OpenSim
164 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); 164 GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey);
165 IGridServer gridServer = GridServers.GridServer; 165 IGridServer gridServer = GridServers.GridServer;
166 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); 166 gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey);
167
168 if(!m_sandbox) {
169 if(GridServers.GridServer.RequestConnection(regionData.SimUUID,regionData.IPListenAddr,(uint)regionData.IPListenPort)) {
170 m_console.WriteLine("Main.cs:Startup() - Got a grid connection OK!");
171 } else {
172 m_console.WriteLine("AAAAAAAAAAAAARRRRRRRRRRGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!");
173 m_console.WriteLine("I LOST MY GRID!!!!!!!!!!!!! AAAAAAAARRRRRRRRGGGGGGGGHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!");
174 Shutdown();
175 }
176 }
177
178 GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]);
167 179
168 LocalWorld.LoadPrimsFromStorage(); 180 LocalWorld.LoadPrimsFromStorage();
169 181
@@ -190,9 +202,11 @@ namespace OpenSim
190 agent_data.firstname = (string)requestData["firstname"]; 202 agent_data.firstname = (string)requestData["firstname"];
191 agent_data.lastname = (string)requestData["lastname"]; 203 agent_data.lastname = (string)requestData["lastname"];
192 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 204 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
193 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 205 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
194 206 if(requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) {
195 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 207 agent_data.child=true;
208 }
209 ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
196 210
197 return new XmlRpcResponse(); 211 return new XmlRpcResponse();
198 }); 212 });
@@ -288,15 +302,52 @@ namespace OpenSim
288 } 302 }
289 else if (packet.Type == PacketType.UseCircuitCode) 303 else if (packet.Type == PacketType.UseCircuitCode)
290 { // new client 304 { // new client
305
291 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 306 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
292 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 307 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
293 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox); 308 SimClient newuser = new SimClient(epSender, useCircuit, LocalWorld, _packetServer.ClientThreads, AssetCache, GridServers.GridServer, this, InventoryCache, m_sandbox,((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child);
294 if ((this.GridServers.UserServer != null) && (user_accounts)) 309 if ((this.GridServers.UserServer != null) && (user_accounts))
295 { 310 {
296 newuser.UserServer = this.GridServers.UserServer; 311 newuser.UserServer = this.GridServers.UserServer;
297 } 312 }
298 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 313 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
299 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 314 this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
315
316 if(!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) {
317 Hashtable SimParams;
318 ArrayList SendParams;
319 XmlRpcRequest GridReq;
320 XmlRpcResponse GridResp;
321 foreach (Hashtable neighbour in ((RemoteGridBase)this.GridServers.GridServer).neighbours) {
322 m_console.WriteLine("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"]);
323 SimParams = new Hashtable();
324 SimParams["session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SessionID.ToString();
325 SimParams["secure_session_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].SecureSessionID.ToString();
326 SimParams["firstname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].firstname;
327 SimParams["lastname"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].lastname;
328 SimParams["agent_id"] = ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].AgentID.ToString();
329 SimParams["circuit_code"] = (Int32)useCircuit.CircuitCode.Code;
330 SimParams["child_agent"]="1";
331 SendParams = new ArrayList();
332 SendParams.Add(SimParams);
333
334 GridReq = new XmlRpcRequest("expect_user", SendParams);
335 GridResp = GridReq.Send("http://" + neighbour["sim_ip"] + ":" + neighbour["sim_port"], 3000);
336 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
337 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
338 enablesimpacket.SimulatorInfo.Handle=Helpers.UIntsToLong((uint)(Convert.ToInt32(neighbour["region_locx"]) * 256), (uint)(Convert.ToInt32(neighbour["region_locy"]) * 256));
339 System.Net.IPAddress neighbourIP = System.Net.IPAddress.Parse((string)neighbour["sim_ip"]);
340 byte[] byteIP = neighbourIP.GetAddressBytes();
341 enablesimpacket.SimulatorInfo.IP=(uint)byteIP[3]<<24;
342 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[2]<<16;
343 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[1]<<8;
344 enablesimpacket.SimulatorInfo.IP+=(uint)byteIP[0];
345 enablesimpacket.SimulatorInfo.Port=(ushort)Convert.ToInt32(neighbour["sim_port"]);
346 Thread.Sleep(3000);
347 _packetServer.ClientThreads[useCircuit.CircuitCode.Code].OutPacket(enablesimpacket);
348 }
349 }
350
300 } 351 }
301 else 352 else
302 { // invalid client 353 { // invalid client
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 6d174c8..c478d92 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -54,6 +54,7 @@ namespace OpenSim
54 public LLUUID AgentID; 54 public LLUUID AgentID;
55 public LLUUID SessionID; 55 public LLUUID SessionID;
56 public LLUUID SecureSessionID = LLUUID.Zero; 56 public LLUUID SecureSessionID = LLUUID.Zero;
57 public bool m_child;
57 public uint CircuitCode; 58 public uint CircuitCode;
58 public world.Avatar ClientAvatar; 59 public world.Avatar ClientAvatar;
59 private UseCircuitCodePacket cirpack; 60 private UseCircuitCodePacket cirpack;
@@ -94,7 +95,7 @@ namespace OpenSim
94 } 95 }
95 } 96 }
96 97
97 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode) 98 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child)
98 { 99 {
99 m_world = world; 100 m_world = world;
100 m_clientThreads = clientThreads; 101 m_clientThreads = clientThreads;
@@ -103,6 +104,7 @@ namespace OpenSim
103 m_application = application; 104 m_application = application;
104 m_inventoryCache = inventoryCache; 105 m_inventoryCache = inventoryCache;
105 m_sandboxMode = sandboxMode; 106 m_sandboxMode = sandboxMode;
107 m_child=child;
106 108
107 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); 109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
108 cirpack = initialcirpack; 110 cirpack = initialcirpack;
@@ -228,8 +230,10 @@ namespace OpenSim
228 switch (Pack.Type) 230 switch (Pack.Type)
229 { 231 {
230 case PacketType.CompleteAgentMovement: 232 case PacketType.CompleteAgentMovement:
231 ClientAvatar.CompleteMovement(m_world); 233 if(!m_child) {
232 ClientAvatar.SendInitialPosition(); 234 ClientAvatar.CompleteMovement(m_world);
235 ClientAvatar.SendInitialPosition();
236 }
233 break; 237 break;
234 case PacketType.RegionHandshakeReply: 238 case PacketType.RegionHandshakeReply:
235 m_world.SendLayerData(this); 239 m_world.SendLayerData(this);
@@ -476,16 +480,18 @@ namespace OpenSim
476 } 480 }
477 break; 481 break;
478 case PacketType.AgentAnimation: 482 case PacketType.AgentAnimation:
479 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; 483 if(!m_child) {
480 for (int i = 0; i < AgentAni.AnimationList.Length; i++) 484 AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
481 { 485 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
482 if (AgentAni.AnimationList[i].StartAnim) 486 {
483 { 487 if (AgentAni.AnimationList[i].StartAnim)
484 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID; 488 {
485 ClientAvatar.anim_seq = 1; 489 ClientAvatar.current_anim = AgentAni.AnimationList[i].AnimID;
486 ClientAvatar.SendAnimPack(); 490 ClientAvatar.anim_seq = 1;
487 } 491 ClientAvatar.SendAnimPack();
488 } 492 }
493 }
494 }
489 break; 495 break;
490 case PacketType.ObjectSelect: 496 case PacketType.ObjectSelect:
491 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; 497 ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack;
diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/AvatarUpdate.cs
index d315de7..453f419 100644
--- a/OpenSim.RegionServer/world/AvatarUpdate.cs
+++ b/OpenSim.RegionServer/world/AvatarUpdate.cs
@@ -89,7 +89,8 @@ namespace OpenSim.world
89 { 89 {
90 System.Text.Encoding _enc = System.Text.Encoding.ASCII; 90 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
91 //send a objectupdate packet with information about the clients avatar 91 //send a objectupdate packet with information about the clients avatar
92 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 92
93 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
93 objupdate.RegionData.RegionHandle = m_regionHandle; 94 objupdate.RegionData.RegionHandle = m_regionHandle;
94 objupdate.RegionData.TimeDilation = 64096; 95 objupdate.RegionData.TimeDilation = 64096;
95 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; 96 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
diff --git a/OpenSim.RegionServer/world/World.cs b/OpenSim.RegionServer/world/World.cs
index a973c6c..425a135 100644
--- a/OpenSim.RegionServer/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -371,19 +371,22 @@ namespace OpenSim.world
371 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 371 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
372 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 372 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
373 newAvatar.SendRegionHandshake(this); 373 newAvatar.SendRegionHandshake(this);
374 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z); 374 if(!agentClient.m_child) {
375 lock (this.LockPhysicsEngine) 375 PhysicsVector pVec = new PhysicsVector(newAvatar.Pos.X, newAvatar.Pos.Y, newAvatar.Pos.Z);
376 { 376 lock (this.LockPhysicsEngine)
377 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 377 {
378 } 378 newAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
379 lock (Entities) 379 }
380 { 380 }
381 this.Entities.Add(agentClient.AgentID, newAvatar); 381 lock (Entities)
382 } 382 {
383 lock (Avatars) 383 this.Entities.Add(agentClient.AgentID, newAvatar);
384 { 384 }
385 this.Avatars.Add(agentClient.AgentID, newAvatar); 385 lock (Avatars)
386 } 386 {
387 this.Avatars.Add(agentClient.AgentID, newAvatar);
388 }
389
387 } 390 }
388 391
389 public void RemoveViewerAgent(SimClient agentClient) 392 public void RemoveViewerAgent(SimClient agentClient)