aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer
diff options
context:
space:
mode:
authorlbsa712007-03-27 18:27:11 +0000
committerlbsa712007-03-27 18:27:11 +0000
commit893a1824d075a6edfd40ac1ef2a7e4fc2fec968c (patch)
tree0bf4a03dd6635be9691c3cc114a4229ac2db5a12 /OpenSim.RegionServer
parent* Prebuild breaks nant build if project is empty. Quick fix : add dummy file (diff)
downloadopensim-SC-893a1824d075a6edfd40ac1ef2a7e4fc2fec968c.zip
opensim-SC-893a1824d075a6edfd40ac1ef2a7e4fc2fec968c.tar.gz
opensim-SC-893a1824d075a6edfd40ac1ef2a7e4fc2fec968c.tar.bz2
opensim-SC-893a1824d075a6edfd40ac1ef2a7e4fc2fec968c.tar.xz
* Introduced BaseHttpServer (doing nothing at the moment)
* Removed OpenSimRoot dependencies from SimClient and AgentAssetUpload. 2 down, 7 left to go.
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/AgentAssetUpload.cs17
-rw-r--r--OpenSim.RegionServer/CAPS/SimHttp.cs41
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj18
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.dll.build3
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs4
-rw-r--r--OpenSim.RegionServer/SimClient.cs99
6 files changed, 108 insertions, 74 deletions
diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs
index a482e80..9f85598 100644
--- a/OpenSim.RegionServer/AgentAssetUpload.cs
+++ b/OpenSim.RegionServer/AgentAssetUpload.cs
@@ -1,6 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Assets;
4using OpenSim.Framework.Assets; 5using OpenSim.Framework.Assets;
5using OpenSim.Framework.Utilities; 6using OpenSim.Framework.Utilities;
6using libsecondlife; 7using libsecondlife;
@@ -12,10 +13,14 @@ namespace OpenSim
12 { 13 {
13 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>(); 14 private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
14 private SimClient ourClient; 15 private SimClient ourClient;
16 private AssetCache m_assetCache;
17 private InventoryCache m_inventoryCache;
15 18
16 public AgentAssetUpload(SimClient client) 19 public AgentAssetUpload(SimClient client, AssetCache assetCache, InventoryCache inventoryCache)
17 { 20 {
18 this.ourClient = client; 21 this.ourClient = client;
22 m_assetCache = assetCache;
23 m_inventoryCache = inventoryCache;
19 } 24 }
20 25
21 public void AddUpload(LLUUID transactionID, AssetBase asset) 26 public void AddUpload(LLUUID transactionID, AssetBase asset)
@@ -148,8 +153,8 @@ namespace OpenSim
148 //check if we should add it to inventory 153 //check if we should add it to inventory
149 if (trans.AddToInventory) 154 if (trans.AddToInventory)
150 { 155 {
151 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 156 m_assetCache.AddAsset(trans.Asset);
152 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); 157 m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
153 } 158 }
154 159
155 160
@@ -176,7 +181,7 @@ namespace OpenSim
176 AssetTransaction trans = this.transactions[transactionID]; 181 AssetTransaction trans = this.transactions[transactionID];
177 if (trans.UploadComplete) 182 if (trans.UploadComplete)
178 { 183 {
179 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 184 m_assetCache.AddAsset(trans.Asset);
180 asset = trans.Asset; 185 asset = trans.Asset;
181 } 186 }
182 } 187 }
@@ -195,8 +200,8 @@ namespace OpenSim
195 if (trans.UploadComplete) 200 if (trans.UploadComplete)
196 { 201 {
197 //already complete so we can add it to the inventory 202 //already complete so we can add it to the inventory
198 OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); 203 m_assetCache.AddAsset(trans.Asset);
199 Console.WriteLine( "ITem created is " +OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); 204 Console.WriteLine( "ITem created is " +m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated());
200 } 205 }
201 else 206 else
202 { 207 {
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index a1073f0..92bbc6f 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -39,22 +39,27 @@ using System.Collections.Generic;
39using libsecondlife; 39using libsecondlife;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Framework.Interfaces; 41using OpenSim.Framework.Interfaces;
42using OpenSim.Servers;
42 43
43namespace OpenSim.CAPS 44namespace OpenSim.CAPS
44{ 45{
45 // Dummy HTTP server, does nothing useful for now 46 // Dummy HTTP server, does nothing useful for now
46 47
47 public class SimCAPSHTTPServer 48 public class SimCAPSHTTPServer : BaseHttpServer
48 { 49 {
49 public Thread HTTPD; 50 private Thread m_workerThread;
50 public HttpListener Listener; 51 private HttpListener m_httpListener;
51 private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>(); 52 private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>();
53 private IGridServer m_gridServer;
54 private int m_port;
52 55
53 public SimCAPSHTTPServer() 56 public SimCAPSHTTPServer(IGridServer gridServer, int port)
54 { 57 {
55 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); 58 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
56 HTTPD = new Thread(new ThreadStart(StartHTTP)); 59 m_workerThread = new Thread(new ThreadStart(StartHTTP));
57 HTTPD.Start(); 60 m_workerThread.Start();
61 m_gridServer = gridServer;
62 m_port = port;
58 } 63 }
59 64
60 public void StartHTTP() 65 public void StartHTTP()
@@ -62,15 +67,15 @@ namespace OpenSim.CAPS
62 try 67 try
63 { 68 {
64 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); 69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
65 Listener = new HttpListener(); 70 m_httpListener = new HttpListener();
66 71
67 Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/"); 72 m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
68 Listener.Start(); 73 m_httpListener.Start();
69 74
70 HttpListenerContext context; 75 HttpListenerContext context;
71 while (true) 76 while (true)
72 { 77 {
73 context = Listener.GetContext(); 78 context = m_httpListener.GetContext();
74 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); 79 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
75 } 80 }
76 } 81 }
@@ -82,9 +87,9 @@ namespace OpenSim.CAPS
82 87
83 public bool AddRestHandler(string path, IRestHandler handler) 88 public bool AddRestHandler(string path, IRestHandler handler)
84 { 89 {
85 if (!this.restHandlers.ContainsKey(path)) 90 if (!this.m_restHandlers.ContainsKey(path))
86 { 91 {
87 this.restHandlers.Add(path, handler); 92 this.m_restHandlers.Add(path, handler);
88 return true; 93 return true;
89 } 94 }
90 95
@@ -108,12 +113,12 @@ namespace OpenSim.CAPS
108 agent_data.lastname = (string)requestData["lastname"]; 113 agent_data.lastname = (string)requestData["lastname"];
109 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 114 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
110 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 115 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
111 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote") 116 if (m_gridServer.GetName() == "Remote")
112 { 117 {
113 ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); 118
119 ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
114 } 120 }
115 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; 121 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
116 break;
117 } 122 }
118 } 123 }
119 catch (Exception e) 124 catch (Exception e)
@@ -135,9 +140,9 @@ namespace OpenSim.CAPS
135 //path[0] should be empty so we are interested in path[1] 140 //path[0] should be empty so we are interested in path[1]
136 if (path.Length > 1) 141 if (path.Length > 1)
137 { 142 {
138 if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1]))) 143 if ((path[1] != "") && (this.m_restHandlers.ContainsKey(path[1])))
139 { 144 {
140 responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); 145 responseString = this.m_restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod);
141 } 146 }
142 } 147 }
143 148
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
index 797a3ec..086e287 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -3,7 +3,7 @@
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion> 5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{90F935D0-00A6-4A5D-82F0-BB7FB8AFC99D}</ProjectGuid> 6 <ProjectGuid>{D385B640-E037-419A-AC83-5CB6E66D9FF3}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon></ApplicationIcon>
@@ -80,21 +80,27 @@
80 </Reference> 80 </Reference>
81 </ItemGroup> 81 </ItemGroup>
82 <ItemGroup> 82 <ItemGroup>
83 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
84 <Name>OpenSim.Framework</Name>
85 <Project>{1817C154-9111-4C45-A19A-609A5717C1FA}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private>
88 </ProjectReference>
83 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> 89 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
84 <Name>OpenSim.Framework.Console</Name> 90 <Name>OpenSim.Framework.Console</Name>
85 <Project>{4E3D1135-5AD9-4C23-BB9A-E4FCCA4B0BC7}</Project> 91 <Project>{023EA61E-BBAE-4FCC-BCDD-43A50FD95D54}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 <Private>False</Private> 93 <Private>False</Private>
88 </ProjectReference> 94 </ProjectReference>
89 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> 95 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
90 <Name>OpenSim.Physics.Manager</Name> 96 <Name>OpenSim.Physics.Manager</Name>
91 <Project>{7D98B8F9-1409-40DD-8A8F-9B7669761B6C}</Project> 97 <Project>{D9A7F5B1-0F86-4463-BA4C-9F15D3981E5C}</Project>
92 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
93 <Private>False</Private> 99 <Private>False</Private>
94 </ProjectReference> 100 </ProjectReference>
95 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> 101 <ProjectReference Include="..\Servers\OpenSim.Servers.csproj">
96 <Name>OpenSim.Framework</Name> 102 <Name>OpenSim.Servers</Name>
97 <Project>{6CE3530E-1D8E-47D8-9B6D-82A86E71D657}</Project> 103 <Project>{570A9C4C-950E-4F9D-9FB1-1A77E1A5C4C2}</Project>
98 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> 104 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
99 <Private>False</Private> 105 <Private>False</Private>
100 </ProjectReference> 106 </ProjectReference>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
index 4e44c4b..d77e896 100644
--- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build
@@ -49,9 +49,10 @@
49 <include name="../bin/libsecondlife.dll" /> 49 <include name="../bin/libsecondlife.dll" />
50 <include name="../bin/Axiom.MathLib.dll" /> 50 <include name="../bin/Axiom.MathLib.dll" />
51 <include name="../bin/Db4objects.Db4o.dll" /> 51 <include name="../bin/Db4objects.Db4o.dll" />
52 <include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
52 <include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" /> 53 <include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
53 <include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" /> 54 <include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
54 <include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" /> 55 <include name="../Servers/${build.dir}/OpenSim.Servers.dll" />
55 </references> 56 </references>
56 </csc> 57 </csc>
57 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> 58 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
index 7425fca..a24d1fb 100644
--- a/OpenSim.RegionServer/OpenSimMain.cs
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -113,7 +113,7 @@ namespace OpenSim
113 } 113 }
114 114
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server"); 115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(); 116 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer(OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Cfg.IPListenPort);
117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin")); 117 OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin"));
118 118
119 timer1.Enabled = true; 119 timer1.Enabled = true;
@@ -172,7 +172,7 @@ namespace OpenSim
172 { // new client 172 { // new client
173 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; 173 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
174 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); 174 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
175 SimClient newuser = new SimClient(epSender, useCircuit); 175 SimClient newuser = new SimClient(epSender, useCircuit, OpenSimRoot.Instance.LocalWorld, OpenSimRoot.Instance.ClientThreads, OpenSimRoot.Instance.AssetCache, OpenSimRoot.Instance.GridServers.GridServer, OpenSimRoot.Instance.Application, OpenSimRoot.Instance.InventoryCache, OpenSimRoot.Instance.Sandbox);
176 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); 176 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
177 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); 177 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
178 } 178 }
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index d463c75..698053d 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -71,6 +71,13 @@ namespace OpenSim
71 private AgentAssetUpload UploadAssets; 71 private AgentAssetUpload UploadAssets;
72 private LLUUID newAssetFolder = LLUUID.Zero; 72 private LLUUID newAssetFolder = LLUUID.Zero;
73 private bool debug = false; 73 private bool debug = false;
74 private World m_world;
75 private Dictionary<uint, SimClient> m_clientThreads;
76 private AssetCache m_assetCache;
77 private IGridServer m_gridServer;
78 private OpenSimApplication m_application;
79 private InventoryCache m_inventoryCache;
80 private bool m_sandboxMode;
74 81
75 private void ack_pack(Packet Pack) 82 private void ack_pack(Packet Pack)
76 { 83 {
@@ -105,15 +112,15 @@ namespace OpenSim
105 switch (Pack.Type) 112 switch (Pack.Type)
106 { 113 {
107 case PacketType.CompleteAgentMovement: 114 case PacketType.CompleteAgentMovement:
108 ClientAvatar.CompleteMovement(OpenSimRoot.Instance.LocalWorld); 115 ClientAvatar.CompleteMovement(m_world);
109 ClientAvatar.SendInitialPosition(); 116 ClientAvatar.SendInitialPosition();
110 break; 117 break;
111 case PacketType.RegionHandshakeReply: 118 case PacketType.RegionHandshakeReply:
112 OpenSimRoot.Instance.LocalWorld.SendLayerData(this); 119 m_world.SendLayerData(this);
113 break; 120 break;
114 case PacketType.AgentWearablesRequest: 121 case PacketType.AgentWearablesRequest:
115 ClientAvatar.SendInitialAppearance(); 122 ClientAvatar.SendInitialAppearance();
116 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 123 foreach (SimClient client in m_clientThreads.Values)
117 { 124 {
118 if (client.AgentID != this.AgentID) 125 if (client.AgentID != this.AgentID)
119 { 126 {
@@ -122,7 +129,7 @@ namespace OpenSim
122 client.ClientAvatar.SendAppearanceToOtherAgent(this); 129 client.ClientAvatar.SendAppearanceToOtherAgent(this);
123 } 130 }
124 } 131 }
125 OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this); 132 m_world.GetInitialPrims(this);
126 break; 133 break;
127 case PacketType.AgentIsNowWearing: 134 case PacketType.AgentIsNowWearing:
128 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; 135 AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack;
@@ -134,7 +141,7 @@ namespace OpenSim
134 this.ClientAvatar.SetAppearance(appear); 141 this.ClientAvatar.SetAppearance(appear);
135 break; 142 break;
136 case PacketType.ObjectAdd: 143 case PacketType.ObjectAdd:
137 OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this); 144 m_world.AddNewPrim((ObjectAddPacket)Pack, this);
138 break; 145 break;
139 case PacketType.ObjectLink: 146 case PacketType.ObjectLink:
140 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); 147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
@@ -146,7 +153,7 @@ namespace OpenSim
146 ObjectShapePacket shape = (ObjectShapePacket)Pack; 153 ObjectShapePacket shape = (ObjectShapePacket)Pack;
147 for (int i = 0; i < shape.ObjectData.Length; i++) 154 for (int i = 0; i < shape.ObjectData.Length; i++)
148 { 155 {
149 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 156 foreach (Entity ent in m_world.Entities.Values)
150 { 157 {
151 if (ent.localid == shape.ObjectData[i].ObjectLocalID) 158 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
152 { 159 {
@@ -163,7 +170,7 @@ namespace OpenSim
163 if (multipleupdate.ObjectData[i].Type == 9) //change position 170 if (multipleupdate.ObjectData[i].Type == 9) //change position
164 { 171 {
165 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 172 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
166 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 173 foreach (Entity ent in m_world.Entities.Values)
167 { 174 {
168 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 175 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
169 { 176 {
@@ -177,7 +184,7 @@ namespace OpenSim
177 else if (multipleupdate.ObjectData[i].Type == 10)//rotation 184 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
178 { 185 {
179 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 186 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
180 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 187 foreach (Entity ent in m_world.Entities.Values)
181 { 188 {
182 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 189 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
183 { 190 {
@@ -190,7 +197,7 @@ namespace OpenSim
190 { 197 {
191 198
192 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 199 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
193 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 200 foreach (Entity ent in m_world.Entities.Values)
194 { 201 {
195 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) 202 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
196 { 203 {
@@ -204,13 +211,13 @@ namespace OpenSim
204 RequestImagePacket imageRequest = (RequestImagePacket)Pack; 211 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
205 for (int i = 0; i < imageRequest.RequestImage.Length; i++) 212 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
206 { 213 {
207 OpenSimRoot.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); 214 m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
208 } 215 }
209 break; 216 break;
210 case PacketType.TransferRequest: 217 case PacketType.TransferRequest:
211 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); 218 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
212 TransferRequestPacket transfer = (TransferRequestPacket)Pack; 219 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
213 OpenSimRoot.Instance.AssetCache.AddAssetRequest(this, transfer); 220 m_assetCache.AddAssetRequest(this, transfer);
214 break; 221 break;
215 case PacketType.AgentUpdate: 222 case PacketType.AgentUpdate:
216 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); 223 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
@@ -230,18 +237,18 @@ namespace OpenSim
230 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 237 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
231 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 238 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
232 kill.ObjectData[0].ID = this.ClientAvatar.localid; 239 kill.ObjectData[0].ID = this.ClientAvatar.localid;
233 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 240 foreach (SimClient client in m_clientThreads.Values)
234 { 241 {
235 client.OutPacket(kill); 242 client.OutPacket(kill);
236 } 243 }
237 OpenSimRoot.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); 244 m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
238 lock (OpenSimRoot.Instance.LocalWorld.Entities) 245 lock (m_world.Entities)
239 { 246 {
240 OpenSimRoot.Instance.LocalWorld.Entities.Remove(this.AgentID); 247 m_world.Entities.Remove(this.AgentID);
241 } 248 }
242 //need to do other cleaning up here too 249 //need to do other cleaning up here too
243 OpenSimRoot.Instance.ClientThreads.Remove(this.CircuitCode); //this.userEP); 250 m_clientThreads.Remove(this.CircuitCode); //this.userEP);
244 OpenSimRoot.Instance.Application.RemoveClientCircuit(this.CircuitCode); 251 m_application.RemoveClientCircuit(this.CircuitCode);
245 this.ClientThread.Abort(); 252 this.ClientThread.Abort();
246 break; 253 break;
247 case PacketType.ChatFromViewer: 254 case PacketType.ChatFromViewer:
@@ -258,7 +265,7 @@ namespace OpenSim
258 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); 265 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
259 reply.ChatData.OwnerID = this.AgentID; 266 reply.ChatData.OwnerID = this.AgentID;
260 reply.ChatData.SourceID = this.AgentID; 267 reply.ChatData.SourceID = this.AgentID;
261 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 268 foreach (SimClient client in m_clientThreads.Values)
262 { 269 {
263 client.OutPacket(reply); 270 client.OutPacket(reply);
264 } 271 }
@@ -267,7 +274,7 @@ namespace OpenSim
267 ObjectImagePacket imagePack = (ObjectImagePacket)Pack; 274 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
268 for (int i = 0; i < imagePack.ObjectData.Length; i++) 275 for (int i = 0; i < imagePack.ObjectData.Length; i++)
269 { 276 {
270 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 277 foreach (Entity ent in m_world.Entities.Values)
271 { 278 {
272 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID) 279 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
273 { 280 {
@@ -278,7 +285,7 @@ namespace OpenSim
278 break; 285 break;
279 case PacketType.ObjectFlagUpdate: 286 case PacketType.ObjectFlagUpdate:
280 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; 287 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
281 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values) 288 foreach (Entity ent in m_world.Entities.Values)
282 { 289 {
283 if (ent.localid == flags.AgentData.ObjectLocalID) 290 if (ent.localid == flags.AgentData.ObjectLocalID)
284 { 291 {
@@ -306,7 +313,7 @@ namespace OpenSim
306 break; 313 break;
307 case PacketType.CreateInventoryFolder: 314 case PacketType.CreateInventoryFolder:
308 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; 315 CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
309 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type); 316 m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type);
310 Console.WriteLine(Pack.ToString()); 317 Console.WriteLine(Pack.ToString());
311 break; 318 break;
312 case PacketType.CreateInventoryItem: 319 case PacketType.CreateInventoryItem:
@@ -320,11 +327,11 @@ namespace OpenSim
320 case PacketType.FetchInventory: 327 case PacketType.FetchInventory:
321 //Console.WriteLine("fetch item packet"); 328 //Console.WriteLine("fetch item packet");
322 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; 329 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
323 OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory); 330 m_inventoryCache.FetchInventory(this, FetchInventory);
324 break; 331 break;
325 case PacketType.FetchInventoryDescendents: 332 case PacketType.FetchInventoryDescendents:
326 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; 333 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
327 OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch); 334 m_inventoryCache.FetchInventoryDescendents(this, Fetch);
328 break; 335 break;
329 case PacketType.UpdateInventoryItem: 336 case PacketType.UpdateInventoryItem:
330 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; 337 UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack;
@@ -332,17 +339,17 @@ namespace OpenSim
332 { 339 {
333 if (update.InventoryData[i].TransactionID != LLUUID.Zero) 340 if (update.InventoryData[i].TransactionID != LLUUID.Zero)
334 { 341 {
335 AssetBase asset = OpenSimRoot.Instance.AssetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); 342 AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
336 if (asset != null) 343 if (asset != null)
337 { 344 {
338 OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); 345 m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
339 } 346 }
340 else 347 else
341 { 348 {
342 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); 349 asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
343 if (asset != null) 350 if (asset != null)
344 { 351 {
345 OpenSimRoot.Instance.InventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); 352 m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
346 } 353 }
347 } 354 }
348 } 355 }
@@ -350,7 +357,7 @@ namespace OpenSim
350 break; 357 break;
351 case PacketType.ViewerEffect: 358 case PacketType.ViewerEffect:
352 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; 359 ViewerEffectPacket viewer = (ViewerEffectPacket)Pack;
353 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values) 360 foreach (SimClient client in m_clientThreads.Values)
354 { 361 {
355 if (client.AgentID != this.AgentID) 362 if (client.AgentID != this.AgentID)
356 { 363 {
@@ -362,7 +369,7 @@ namespace OpenSim
362 break; 369 break;
363 case PacketType.DeRezObject: 370 case PacketType.DeRezObject:
364 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); 371 //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet");
365 OpenSimRoot.Instance.LocalWorld.DeRezObject((DeRezObjectPacket)Pack, this); 372 m_world.DeRezObject((DeRezObjectPacket)Pack, this);
366 break; 373 break;
367 } 374 }
368 } 375 }
@@ -501,11 +508,11 @@ namespace OpenSim
501 if (Pack.Header.Zerocoded) 508 if (Pack.Header.Zerocoded)
502 { 509 {
503 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 510 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
504 OpenSimRoot.Instance.Application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP); 511 m_application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
505 } 512 }
506 else 513 else
507 { 514 {
508 OpenSimRoot.Instance.Application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP); 515 m_application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
509 } 516 }
510 } 517 }
511 catch (Exception) 518 catch (Exception)
@@ -569,14 +576,22 @@ namespace OpenSim
569 this.PacketQueue.Enqueue(item); 576 this.PacketQueue.Enqueue(item);
570 } 577 }
571 578
572 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) 579 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimApplication application, InventoryCache inventoryCache, bool sandboxMode)
573 { 580 {
581 m_world = world;
582 m_clientThreads = clientThreads;
583 m_assetCache = assetCache;
584 m_gridServer = gridServer;
585 m_application = application;
586 m_inventoryCache = inventoryCache;
587 m_sandboxMode = sandboxMode;
588
574 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); 589 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
575 cirpack = initialcirpack; 590 cirpack = initialcirpack;
576 userEP = remoteEP; 591 userEP = remoteEP;
577 PacketQueue = new BlockingQueue<QueItem>(); 592 PacketQueue = new BlockingQueue<QueItem>();
578 593
579 this.UploadAssets = new AgentAssetUpload(this); 594 this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache );
580 AckTimer = new System.Timers.Timer(500); 595 AckTimer = new System.Timers.Timer(500);
581 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); 596 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
582 AckTimer.Start(); 597 AckTimer.Start();
@@ -608,14 +623,16 @@ namespace OpenSim
608 protected virtual void InitNewClient() 623 protected virtual void InitNewClient()
609 { 624 {
610 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 625 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
611 OpenSimRoot.Instance.LocalWorld.AddViewerAgent(this); 626
612 world.Entity tempent = OpenSimRoot.Instance.LocalWorld.Entities[this.AgentID]; 627 m_world.AddViewerAgent(this);
628 world.Entity tempent = m_world.Entities[this.AgentID];
629
613 this.ClientAvatar = (world.Avatar)tempent; 630 this.ClientAvatar = (world.Avatar)tempent;
614 } 631 }
615 632
616 protected virtual void AuthUser() 633 protected virtual void AuthUser()
617 { 634 {
618 AuthenticateResponse sessionInfo = OpenSimRoot.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 635 AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
619 if (!sessionInfo.Authorised) 636 if (!sessionInfo.Authorised)
620 { 637 {
621 //session/circuit not authorised 638 //session/circuit not authorised
@@ -638,23 +655,23 @@ namespace OpenSim
638 } 655 }
639 656
640 // Create Inventory, currently only works for sandbox mode 657 // Create Inventory, currently only works for sandbox mode
641 if (OpenSimRoot.Instance.Sandbox) 658 if (m_sandboxMode)
642 { 659 {
643 if (sessionInfo.LoginInfo.InventoryFolder != null) 660 if (sessionInfo.LoginInfo.InventoryFolder != null)
644 { 661 {
645 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder); 662 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
646 if (sessionInfo.LoginInfo.BaseFolder != null) 663 if (sessionInfo.LoginInfo.BaseFolder != null)
647 { 664 {
648 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder); 665 m_inventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
649 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder; 666 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
650 AssetBase[] inventorySet = OpenSimRoot.Instance.AssetCache.CreateNewInventorySet(this.AgentID); 667 AssetBase[] inventorySet = m_assetCache.CreateNewInventorySet(this.AgentID);
651 if (inventorySet != null) 668 if (inventorySet != null)
652 { 669 {
653 for (int i = 0; i < inventorySet.Length; i++) 670 for (int i = 0; i < inventorySet.Length; i++)
654 { 671 {
655 if (inventorySet[i] != null) 672 if (inventorySet[i] != null)
656 { 673 {
657 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]); 674 m_inventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
658 } 675 }
659 } 676 }
660 } 677 }
@@ -670,8 +687,8 @@ namespace OpenSim
670 { 687 {
671 AgentInventory inventory = new AgentInventory(); 688 AgentInventory inventory = new AgentInventory();
672 inventory.AgentID = this.AgentID; 689 inventory.AgentID = this.AgentID;
673 OpenSimRoot.Instance.InventoryCache.AddNewAgentsInventory(inventory); 690 m_inventoryCache.AddNewAgentsInventory(inventory);
674 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder); 691 m_inventoryCache.CreateNewInventoryFolder(this, baseFolder);
675 } 692 }
676 } 693 }
677} 694}