diff options
author | MW | 2007-03-31 21:18:05 +0000 |
---|---|---|
committer | MW | 2007-03-31 21:18:05 +0000 |
commit | 548b125b7c628f078854f95ba2ab9f3973ee4841 (patch) | |
tree | bf3bb092bd309a6a20d14627e9606a1727f90087 | |
parent | Can now Rez and DeRez objects (take to and from inventory). (diff) | |
download | opensim-SC-548b125b7c628f078854f95ba2ab9f3973ee4841.zip opensim-SC-548b125b7c628f078854f95ba2ab9f3973ee4841.tar.gz opensim-SC-548b125b7c628f078854f95ba2ab9f3973ee4841.tar.bz2 opensim-SC-548b125b7c628f078854f95ba2ab9f3973ee4841.tar.xz |
Added Packet handlers to SimClient
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 1 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 754 |
2 files changed, 402 insertions, 353 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index b173088..9d0e6ae 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -50,6 +50,7 @@ using OpenSim.Servers; | |||
50 | 50 | ||
51 | namespace OpenSim | 51 | namespace OpenSim |
52 | { | 52 | { |
53 | |||
53 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback | 54 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback |
54 | { | 55 | { |
55 | private PhysicsManager physManager; | 56 | private PhysicsManager physManager; |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 52cb067..94c5767 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -43,6 +43,8 @@ using OpenSim.Assets; | |||
43 | 43 | ||
44 | namespace OpenSim | 44 | namespace OpenSim |
45 | { | 45 | { |
46 | public delegate bool PacketMethod(SimClient simClient, Packet packet); | ||
47 | |||
46 | /// <summary> | 48 | /// <summary> |
47 | /// Handles new client connections | 49 | /// Handles new client connections |
48 | /// Constructor takes a single Packet and authenticates everything | 50 | /// Constructor takes a single Packet and authenticates everything |
@@ -80,6 +82,12 @@ namespace OpenSim | |||
80 | private bool m_sandboxMode; | 82 | private bool m_sandboxMode; |
81 | private int cachedtextureserial = 0; | 83 | private int cachedtextureserial = 0; |
82 | 84 | ||
85 | // local packet handler list not currently used but is here so each client could have a different handler for a packet to another client | ||
86 | // this is so we could do such things as have multiple world objects in a sim (or multiple "sims" handled by one server and different clients in different worlds | ||
87 | // maybe not a very practicle example but there are various other things it could be used for. | ||
88 | // protected Dictionary<string, PacketMethod> m_packetHandlers = new Dictionary<string, PacketMethod>(); | ||
89 | |||
90 | protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); | ||
83 | 91 | ||
84 | public IUserServer UserServer | 92 | public IUserServer UserServer |
85 | { | 93 | { |
@@ -89,6 +97,37 @@ namespace OpenSim | |||
89 | } | 97 | } |
90 | } | 98 | } |
91 | 99 | ||
100 | public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) | ||
101 | { | ||
102 | bool result = false; | ||
103 | lock (PacketHandlers) | ||
104 | { | ||
105 | if (!PacketHandlers.ContainsKey(packetType)) | ||
106 | { | ||
107 | PacketHandlers.Add(packetType, handler); | ||
108 | result = true; | ||
109 | } | ||
110 | } | ||
111 | return result; | ||
112 | } | ||
113 | |||
114 | protected virtual bool ProcessPacketMethod(Packet packet) | ||
115 | { | ||
116 | bool result = false; | ||
117 | bool found = false; | ||
118 | PacketMethod method; | ||
119 | lock (PacketHandlers) | ||
120 | { | ||
121 | found = PacketHandlers.TryGetValue(packet.Type, out method); | ||
122 | } | ||
123 | if (found) | ||
124 | { | ||
125 | result = method(this, packet); | ||
126 | } | ||
127 | |||
128 | return result; | ||
129 | } | ||
130 | |||
92 | private void ack_pack(Packet Pack) | 131 | private void ack_pack(Packet Pack) |
93 | { | 132 | { |
94 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); | 133 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); |
@@ -112,7 +151,6 @@ namespace OpenSim | |||
112 | protected virtual void ProcessInPacket(Packet Pack) | 151 | protected virtual void ProcessInPacket(Packet Pack) |
113 | { | 152 | { |
114 | ack_pack(Pack); | 153 | ack_pack(Pack); |
115 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
116 | if (debug) | 154 | if (debug) |
117 | { | 155 | { |
118 | if (Pack.Type != PacketType.AgentUpdate) | 156 | if (Pack.Type != PacketType.AgentUpdate) |
@@ -120,410 +158,420 @@ namespace OpenSim | |||
120 | Console.WriteLine(Pack.Type.ToString()); | 158 | Console.WriteLine(Pack.Type.ToString()); |
121 | } | 159 | } |
122 | } | 160 | } |
123 | switch (Pack.Type) | 161 | |
162 | if (this.ProcessPacketMethod(Pack)) | ||
124 | { | 163 | { |
125 | case PacketType.CompleteAgentMovement: | 164 | return; |
126 | ClientAvatar.CompleteMovement(m_world); | 165 | } |
127 | ClientAvatar.SendInitialPosition(); | 166 | else |
128 | break; | 167 | { |
129 | case PacketType.RegionHandshakeReply: | 168 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
130 | m_world.SendLayerData(this); | 169 | |
131 | break; | 170 | switch (Pack.Type) |
132 | case PacketType.AgentWearablesRequest: | 171 | { |
133 | ClientAvatar.SendInitialAppearance(); | 172 | case PacketType.CompleteAgentMovement: |
134 | foreach (SimClient client in m_clientThreads.Values) | 173 | ClientAvatar.CompleteMovement(m_world); |
135 | { | 174 | ClientAvatar.SendInitialPosition(); |
136 | if (client.AgentID != this.AgentID) | 175 | break; |
176 | case PacketType.RegionHandshakeReply: | ||
177 | m_world.SendLayerData(this); | ||
178 | break; | ||
179 | case PacketType.AgentWearablesRequest: | ||
180 | ClientAvatar.SendInitialAppearance(); | ||
181 | foreach (SimClient client in m_clientThreads.Values) | ||
137 | { | 182 | { |
138 | ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); | 183 | if (client.AgentID != this.AgentID) |
139 | this.OutPacket(objupdate); | 184 | { |
140 | client.ClientAvatar.SendAppearanceToOtherAgent(this); | 185 | ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket(); |
186 | this.OutPacket(objupdate); | ||
187 | client.ClientAvatar.SendAppearanceToOtherAgent(this); | ||
188 | } | ||
141 | } | 189 | } |
142 | } | 190 | m_world.GetInitialPrims(this); |
143 | m_world.GetInitialPrims(this); | 191 | break; |
144 | break; | 192 | case PacketType.AgentIsNowWearing: |
145 | case PacketType.AgentIsNowWearing: | 193 | AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; |
146 | AgentIsNowWearingPacket wear = (AgentIsNowWearingPacket)Pack; | 194 | //Console.WriteLine(Pack.ToString()); |
147 | //Console.WriteLine(Pack.ToString()); | 195 | break; |
148 | break; | 196 | case PacketType.AgentSetAppearance: |
149 | case PacketType.AgentSetAppearance: | 197 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; |
150 | AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; | 198 | // Console.WriteLine(appear.ToString()); |
151 | // Console.WriteLine(appear.ToString()); | 199 | this.ClientAvatar.SetAppearance(appear); |
152 | this.ClientAvatar.SetAppearance(appear); | 200 | break; |
153 | break; | 201 | case PacketType.AgentCachedTexture: |
154 | case PacketType.AgentCachedTexture: | 202 | Console.WriteLine(Pack.ToString()); |
155 | Console.WriteLine(Pack.ToString()); | 203 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)Pack; |
156 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket)Pack; | 204 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); |
157 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | 205 | cachedresp.AgentData.AgentID = this.AgentID; |
158 | cachedresp.AgentData.AgentID = this.AgentID; | 206 | cachedresp.AgentData.SessionID = this.SessionID; |
159 | cachedresp.AgentData.SessionID = this.SessionID; | 207 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; |
160 | cachedresp.AgentData.SerialNum = this.cachedtextureserial; | 208 | this.cachedtextureserial++; |
161 | this.cachedtextureserial++; | 209 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; |
162 | cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[chechedtex.WearableData.Length]; | 210 | for (int i = 0; i < chechedtex.WearableData.Length; i++) |
163 | for (int i = 0; i < chechedtex.WearableData.Length; i++) | 211 | { |
164 | { | 212 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); |
165 | cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); | 213 | cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; |
166 | cachedresp.WearableData[i].TextureIndex = chechedtex.WearableData[i].TextureIndex; | 214 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; |
167 | cachedresp.WearableData[i].TextureID = LLUUID.Zero; | 215 | cachedresp.WearableData[i].HostName = new byte[0]; |
168 | cachedresp.WearableData[i].HostName = new byte[0]; | 216 | } |
169 | } | 217 | this.OutPacket(cachedresp); |
170 | this.OutPacket(cachedresp); | 218 | break; |
171 | break; | 219 | case PacketType.ObjectAdd: |
172 | case PacketType.ObjectAdd: | 220 | m_world.AddNewPrim((ObjectAddPacket)Pack, this); |
173 | m_world.AddNewPrim((ObjectAddPacket)Pack, this); | 221 | break; |
174 | break; | 222 | case PacketType.ObjectLink: |
175 | case PacketType.ObjectLink: | 223 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); |
176 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); | 224 | break; |
177 | break; | 225 | case PacketType.ObjectScale: |
178 | case PacketType.ObjectScale: | 226 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); |
179 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString()); | 227 | break; |
180 | break; | 228 | case PacketType.ObjectShape: |
181 | case PacketType.ObjectShape: | 229 | ObjectShapePacket shape = (ObjectShapePacket)Pack; |
182 | ObjectShapePacket shape = (ObjectShapePacket)Pack; | 230 | for (int i = 0; i < shape.ObjectData.Length; i++) |
183 | for (int i = 0; i < shape.ObjectData.Length; i++) | ||
184 | { | ||
185 | foreach (Entity ent in m_world.Entities.Values) | ||
186 | { | 231 | { |
187 | if (ent.localid == shape.ObjectData[i].ObjectLocalID) | 232 | foreach (Entity ent in m_world.Entities.Values) |
188 | { | 233 | { |
189 | ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]); | 234 | if (ent.localid == shape.ObjectData[i].ObjectLocalID) |
235 | { | ||
236 | ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]); | ||
237 | } | ||
190 | } | 238 | } |
191 | } | 239 | } |
192 | } | 240 | break; |
193 | break; | 241 | case PacketType.MultipleObjectUpdate: |
194 | case PacketType.MultipleObjectUpdate: | 242 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack; |
195 | MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack; | ||
196 | 243 | ||
197 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) | 244 | for (int i = 0; i < multipleupdate.ObjectData.Length; i++) |
198 | { | ||
199 | if (multipleupdate.ObjectData[i].Type == 9) //change position | ||
200 | { | 245 | { |
201 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); | 246 | if (multipleupdate.ObjectData[i].Type == 9) //change position |
202 | foreach (Entity ent in m_world.Entities.Values) | ||
203 | { | 247 | { |
204 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) | 248 | libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); |
249 | foreach (Entity ent in m_world.Entities.Values) | ||
205 | { | 250 | { |
206 | ((OpenSim.world.Primitive)ent).UpdatePosition(pos); | 251 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) |
252 | { | ||
253 | ((OpenSim.world.Primitive)ent).UpdatePosition(pos); | ||
207 | 254 | ||
255 | } | ||
208 | } | 256 | } |
209 | } | ||
210 | 257 | ||
211 | //should update stored position of the prim | 258 | //should update stored position of the prim |
212 | } | 259 | } |
213 | else if (multipleupdate.ObjectData[i].Type == 10)//rotation | 260 | else if (multipleupdate.ObjectData[i].Type == 10)//rotation |
214 | { | ||
215 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); | ||
216 | foreach (Entity ent in m_world.Entities.Values) | ||
217 | { | 261 | { |
218 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) | 262 | libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); |
263 | foreach (Entity ent in m_world.Entities.Values) | ||
219 | { | 264 | { |
220 | ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | 265 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) |
221 | ((OpenSim.world.Primitive)ent).UpdateFlag = true; | 266 | { |
267 | ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); | ||
268 | ((OpenSim.world.Primitive)ent).UpdateFlag = true; | ||
269 | } | ||
222 | } | 270 | } |
223 | } | 271 | } |
272 | else if (multipleupdate.ObjectData[i].Type == 13)//scale | ||
273 | { | ||
274 | |||
275 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | ||
276 | foreach (Entity ent in m_world.Entities.Values) | ||
277 | { | ||
278 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) | ||
279 | { | ||
280 | ((OpenSim.world.Primitive)ent).Scale = scale; | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | break; | ||
286 | case PacketType.RequestImage: | ||
287 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | ||
288 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | ||
289 | { | ||
290 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); | ||
224 | } | 291 | } |
225 | else if (multipleupdate.ObjectData[i].Type == 13)//scale | 292 | break; |
293 | case PacketType.TransferRequest: | ||
294 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | ||
295 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
296 | m_assetCache.AddAssetRequest(this, transfer); | ||
297 | break; | ||
298 | case PacketType.AgentUpdate: | ||
299 | ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); | ||
300 | break; | ||
301 | case PacketType.LogoutRequest: | ||
302 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
303 | //send reply to let the client logout | ||
304 | LogoutReplyPacket logReply = new LogoutReplyPacket(); | ||
305 | logReply.AgentData.AgentID = this.AgentID; | ||
306 | logReply.AgentData.SessionID = this.SessionID; | ||
307 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; | ||
308 | logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); | ||
309 | logReply.InventoryData[0].ItemID = LLUUID.Zero; | ||
310 | OutPacket(logReply); | ||
311 | //tell all clients to kill our object | ||
312 | KillObjectPacket kill = new KillObjectPacket(); | ||
313 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
314 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
315 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | ||
316 | foreach (SimClient client in m_clientThreads.Values) | ||
226 | { | 317 | { |
318 | client.OutPacket(kill); | ||
319 | } | ||
320 | if (this.m_userServer != null) | ||
321 | { | ||
322 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
323 | } | ||
324 | else | ||
325 | { | ||
326 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
327 | } | ||
227 | 328 | ||
228 | libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); | 329 | m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); |
330 | lock (m_world.Entities) | ||
331 | { | ||
332 | m_world.Entities.Remove(this.AgentID); | ||
333 | } | ||
334 | //need to do other cleaning up here too | ||
335 | m_clientThreads.Remove(this.CircuitCode); //this.userEP); | ||
336 | m_application.RemoveClientCircuit(this.CircuitCode); | ||
337 | this.ClientThread.Abort(); | ||
338 | break; | ||
339 | case PacketType.ChatFromViewer: | ||
340 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
341 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break; | ||
342 | |||
343 | |||
344 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
345 | reply.ChatData.Audible = 1; | ||
346 | reply.ChatData.Message = inchatpack.ChatData.Message; | ||
347 | reply.ChatData.ChatType = 1; | ||
348 | reply.ChatData.SourceType = 1; | ||
349 | reply.ChatData.Position = this.ClientAvatar.position; | ||
350 | reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); | ||
351 | reply.ChatData.OwnerID = this.AgentID; | ||
352 | reply.ChatData.SourceID = this.AgentID; | ||
353 | foreach (SimClient client in m_clientThreads.Values) | ||
354 | { | ||
355 | client.OutPacket(reply); | ||
356 | } | ||
357 | break; | ||
358 | case PacketType.ObjectImage: | ||
359 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
360 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
361 | { | ||
229 | foreach (Entity ent in m_world.Entities.Values) | 362 | foreach (Entity ent in m_world.Entities.Values) |
230 | { | 363 | { |
231 | if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID) | 364 | if (ent.localid == imagePack.ObjectData[i].ObjectLocalID) |
232 | { | 365 | { |
233 | ((OpenSim.world.Primitive)ent).Scale = scale; | 366 | ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry); |
234 | } | 367 | } |
235 | } | 368 | } |
236 | } | 369 | } |
237 | } | 370 | break; |
238 | break; | 371 | case PacketType.ObjectFlagUpdate: |
239 | case PacketType.RequestImage: | 372 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; |
240 | RequestImagePacket imageRequest = (RequestImagePacket)Pack; | ||
241 | for (int i = 0; i < imageRequest.RequestImage.Length; i++) | ||
242 | { | ||
243 | m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image); | ||
244 | } | ||
245 | break; | ||
246 | case PacketType.TransferRequest: | ||
247 | //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | ||
248 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
249 | m_assetCache.AddAssetRequest(this, transfer); | ||
250 | break; | ||
251 | case PacketType.AgentUpdate: | ||
252 | ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack); | ||
253 | break; | ||
254 | case PacketType.LogoutRequest: | ||
255 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
256 | //send reply to let the client logout | ||
257 | LogoutReplyPacket logReply = new LogoutReplyPacket(); | ||
258 | logReply.AgentData.AgentID = this.AgentID; | ||
259 | logReply.AgentData.SessionID = this.SessionID; | ||
260 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; | ||
261 | logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); | ||
262 | logReply.InventoryData[0].ItemID = LLUUID.Zero; | ||
263 | OutPacket(logReply); | ||
264 | //tell all clients to kill our object | ||
265 | KillObjectPacket kill = new KillObjectPacket(); | ||
266 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | ||
267 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | ||
268 | kill.ObjectData[0].ID = this.ClientAvatar.localid; | ||
269 | foreach (SimClient client in m_clientThreads.Values) | ||
270 | { | ||
271 | client.OutPacket(kill); | ||
272 | } | ||
273 | if (this.m_userServer != null) | ||
274 | { | ||
275 | this.m_inventoryCache.ClientLeaving(this.AgentID, this.m_userServer); | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | this.m_inventoryCache.ClientLeaving(this.AgentID, null); | ||
280 | } | ||
281 | |||
282 | m_gridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode); | ||
283 | lock (m_world.Entities) | ||
284 | { | ||
285 | m_world.Entities.Remove(this.AgentID); | ||
286 | } | ||
287 | //need to do other cleaning up here too | ||
288 | m_clientThreads.Remove(this.CircuitCode); //this.userEP); | ||
289 | m_application.RemoveClientCircuit(this.CircuitCode); | ||
290 | this.ClientThread.Abort(); | ||
291 | break; | ||
292 | case PacketType.ChatFromViewer: | ||
293 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
294 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break; | ||
295 | |||
296 | |||
297 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
298 | reply.ChatData.Audible = 1; | ||
299 | reply.ChatData.Message = inchatpack.ChatData.Message; | ||
300 | reply.ChatData.ChatType = 1; | ||
301 | reply.ChatData.SourceType = 1; | ||
302 | reply.ChatData.Position = this.ClientAvatar.position; | ||
303 | reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); | ||
304 | reply.ChatData.OwnerID = this.AgentID; | ||
305 | reply.ChatData.SourceID = this.AgentID; | ||
306 | foreach (SimClient client in m_clientThreads.Values) | ||
307 | { | ||
308 | client.OutPacket(reply); | ||
309 | } | ||
310 | break; | ||
311 | case PacketType.ObjectImage: | ||
312 | ObjectImagePacket imagePack = (ObjectImagePacket)Pack; | ||
313 | for (int i = 0; i < imagePack.ObjectData.Length; i++) | ||
314 | { | ||
315 | foreach (Entity ent in m_world.Entities.Values) | 373 | foreach (Entity ent in m_world.Entities.Values) |
316 | { | 374 | { |
317 | if (ent.localid == imagePack.ObjectData[i].ObjectLocalID) | 375 | if (ent.localid == flags.AgentData.ObjectLocalID) |
318 | { | 376 | { |
319 | ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry); | 377 | ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags); |
320 | } | 378 | } |
321 | } | 379 | } |
322 | } | ||
323 | break; | ||
324 | case PacketType.ObjectFlagUpdate: | ||
325 | ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack; | ||
326 | foreach (Entity ent in m_world.Entities.Values) | ||
327 | { | ||
328 | if (ent.localid == flags.AgentData.ObjectLocalID) | ||
329 | { | ||
330 | ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags); | ||
331 | } | ||
332 | } | ||
333 | 380 | ||
334 | break; | 381 | break; |
335 | case PacketType.AssetUploadRequest: | 382 | case PacketType.AssetUploadRequest: |
336 | //this.debug = true; | 383 | //this.debug = true; |
337 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; | 384 | AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; |
338 | // Console.WriteLine(Pack.ToString()); | 385 | // Console.WriteLine(Pack.ToString()); |
339 | // if (request.AssetBlock.Type == 0) | 386 | // if (request.AssetBlock.Type == 0) |
340 | // { | 387 | // { |
341 | //this.UploadAssets.HandleUploadPacket(request, LLUUID.Random()); | 388 | //this.UploadAssets.HandleUploadPacket(request, LLUUID.Random()); |
342 | //} | 389 | //} |
343 | //else | 390 | //else |
344 | //{ | 391 | //{ |
345 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); | 392 | this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); |
346 | //} | 393 | //} |
347 | break; | 394 | break; |
348 | case PacketType.SendXferPacket: | 395 | case PacketType.SendXferPacket: |
349 | Console.WriteLine(Pack.ToString()); | 396 | Console.WriteLine(Pack.ToString()); |
350 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); | 397 | this.UploadAssets.HandleXferPacket((SendXferPacketPacket)Pack); |
351 | break; | 398 | break; |
352 | case PacketType.CreateInventoryFolder: | 399 | case PacketType.CreateInventoryFolder: |
353 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 400 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
354 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Helpers.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); | 401 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Helpers.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); |
355 | Console.WriteLine(Pack.ToString()); | 402 | Console.WriteLine(Pack.ToString()); |
356 | break; | 403 | break; |
357 | case PacketType.CreateInventoryItem: | 404 | case PacketType.CreateInventoryItem: |
358 | Console.WriteLine(Pack.ToString()); | 405 | Console.WriteLine(Pack.ToString()); |
359 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; | 406 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket)Pack; |
360 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) | 407 | if (createItem.InventoryBlock.TransactionID != LLUUID.Zero) |
361 | { | ||
362 | this.UploadAssets.CreateInventoryItem(createItem); | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | Console.Write(Pack.ToString()); | ||
367 | this.CreateInventoryItem(createItem); | ||
368 | } | ||
369 | break; | ||
370 | case PacketType.FetchInventory: | ||
371 | //Console.WriteLine("fetch item packet"); | ||
372 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | ||
373 | m_inventoryCache.FetchInventory(this, FetchInventory); | ||
374 | break; | ||
375 | case PacketType.FetchInventoryDescendents: | ||
376 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
377 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
378 | break; | ||
379 | case PacketType.UpdateInventoryItem: | ||
380 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | ||
381 | //Console.WriteLine(Pack.ToString()); | ||
382 | for (int i = 0; i < update.InventoryData.Length; i++) | ||
383 | { | ||
384 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | ||
385 | { | 408 | { |
386 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); | 409 | this.UploadAssets.CreateInventoryItem(createItem); |
387 | if (asset != null) | 410 | } |
388 | { | 411 | else |
389 | Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); | 412 | { |
390 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | 413 | Console.Write(Pack.ToString()); |
391 | } | 414 | this.CreateInventoryItem(createItem); |
392 | else | 415 | } |
416 | break; | ||
417 | case PacketType.FetchInventory: | ||
418 | //Console.WriteLine("fetch item packet"); | ||
419 | FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack; | ||
420 | m_inventoryCache.FetchInventory(this, FetchInventory); | ||
421 | break; | ||
422 | case PacketType.FetchInventoryDescendents: | ||
423 | FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack; | ||
424 | m_inventoryCache.FetchInventoryDescendents(this, Fetch); | ||
425 | break; | ||
426 | case PacketType.UpdateInventoryItem: | ||
427 | UpdateInventoryItemPacket update = (UpdateInventoryItemPacket)Pack; | ||
428 | //Console.WriteLine(Pack.ToString()); | ||
429 | for (int i = 0; i < update.InventoryData.Length; i++) | ||
430 | { | ||
431 | if (update.InventoryData[i].TransactionID != LLUUID.Zero) | ||
393 | { | 432 | { |
394 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); | 433 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); |
395 | if (asset != null) | 434 | if (asset != null) |
396 | { | 435 | { |
397 | Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); | 436 | Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); |
398 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | 437 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); |
399 | } | 438 | } |
400 | else | 439 | else |
401 | { | 440 | { |
402 | Console.WriteLine("trying to update inventory item, but asset is null"); | 441 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); |
442 | if (asset != null) | ||
443 | { | ||
444 | Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); | ||
445 | m_inventoryCache.UpdateInventoryItemAsset(this, update.InventoryData[i].ItemID, asset); | ||
446 | } | ||
447 | else | ||
448 | { | ||
449 | Console.WriteLine("trying to update inventory item, but asset is null"); | ||
450 | } | ||
403 | } | 451 | } |
404 | } | 452 | } |
453 | else | ||
454 | { | ||
455 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | ||
456 | } | ||
405 | } | 457 | } |
406 | else | 458 | break; |
459 | case PacketType.ViewerEffect: | ||
460 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | ||
461 | foreach (SimClient client in m_clientThreads.Values) | ||
407 | { | 462 | { |
408 | m_inventoryCache.UpdateInventoryItemDetails(this, update.InventoryData[i].ItemID, update.InventoryData[i]); ; | 463 | if (client.AgentID != this.AgentID) |
464 | { | ||
465 | viewer.AgentData.AgentID = client.AgentID; | ||
466 | viewer.AgentData.SessionID = client.SessionID; | ||
467 | client.OutPacket(viewer); | ||
468 | } | ||
409 | } | 469 | } |
410 | } | 470 | break; |
411 | break; | 471 | case PacketType.DeRezObject: |
412 | case PacketType.ViewerEffect: | 472 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); |
413 | ViewerEffectPacket viewer = (ViewerEffectPacket)Pack; | 473 | m_world.DeRezObject((DeRezObjectPacket)Pack, this); |
414 | foreach (SimClient client in m_clientThreads.Values) | 474 | break; |
415 | { | 475 | case PacketType.RezObject: |
416 | if (client.AgentID != this.AgentID) | 476 | //Console.WriteLine(Pack.ToString()); |
477 | m_world.RezObject(this, (RezObjectPacket)Pack); | ||
478 | break; | ||
479 | case PacketType.ModifyLand: | ||
480 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | ||
481 | //Console.WriteLine("terraform: number of parcel data blocks" + modify.ParcelData.Length); | ||
482 | |||
483 | switch (modify.ModifyBlock.Action) | ||
417 | { | 484 | { |
418 | viewer.AgentData.AgentID = client.AgentID; | 485 | case 1: |
419 | viewer.AgentData.SessionID = client.SessionID; | 486 | if (modify.ParcelData.Length > 0) |
420 | client.OutPacket(viewer); | 487 | { |
488 | int mody = (int)modify.ParcelData[0].North; | ||
489 | int modx = (int)modify.ParcelData[0].West; | ||
490 | // Console.WriteLine("height in packet is " + modify.ModifyBlock.Height.ToString()); | ||
491 | // Console.WriteLine("current height at that point is " + this.m_world.LandMap[(mody * 256) + modx].ToString()); | ||
492 | |||
493 | this.m_world.LandMap[(mody * 256) + modx - 1] += 0.05f; | ||
494 | this.m_world.LandMap[(mody * 256) + modx] += 0.1f; | ||
495 | this.m_world.LandMap[(mody * 256) + modx + 1] += 0.05f; | ||
496 | this.m_world.LandMap[((mody + 1) * 256) + modx] += 0.05f; | ||
497 | this.m_world.LandMap[((mody - 1) * 256) + modx] += 0.05f; | ||
498 | m_world.RegenerateTerrain(true, modx, mody); | ||
499 | } | ||
500 | break; | ||
501 | case 2: | ||
502 | if (modify.ParcelData.Length > 0) | ||
503 | { | ||
504 | int mody = (int)modify.ParcelData[0].North; | ||
505 | int modx = (int)modify.ParcelData[0].West; | ||
506 | // Console.WriteLine("height in packet is " + modify.ModifyBlock.Height.ToString()); | ||
507 | // Console.WriteLine("current height at that point is " + this.m_world.LandMap[(mody * 256) + modx].ToString()); | ||
508 | |||
509 | this.m_world.LandMap[(mody * 256) + modx - 1] -= 0.05f; | ||
510 | this.m_world.LandMap[(mody * 256) + modx] -= 0.1f; | ||
511 | this.m_world.LandMap[(mody * 256) + modx + 1] -= 0.05f; | ||
512 | this.m_world.LandMap[((mody + 1) * 256) + modx] -= 0.05f; | ||
513 | this.m_world.LandMap[((mody - 1) * 256) + modx] -= 0.05f; | ||
514 | m_world.RegenerateTerrain(true, modx, mody); | ||
515 | } | ||
516 | break; | ||
421 | } | 517 | } |
422 | } | 518 | break; |
423 | break; | 519 | case PacketType.RequestTaskInventory: |
424 | case PacketType.DeRezObject: | 520 | // Console.WriteLine(Pack.ToString()); |
425 | //OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Received DeRezObject packet"); | 521 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; |
426 | m_world.DeRezObject((DeRezObjectPacket)Pack, this); | 522 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); |
427 | break; | 523 | bool foundent = false; |
428 | case PacketType.RezObject: | 524 | foreach (Entity ent in m_world.Entities.Values) |
429 | //Console.WriteLine(Pack.ToString()); | 525 | { |
430 | m_world.RezObject(this, (RezObjectPacket)Pack); | 526 | if (ent.localid == requesttask.InventoryData.LocalID) |
431 | break; | ||
432 | case PacketType.ModifyLand: | ||
433 | ModifyLandPacket modify = (ModifyLandPacket)Pack; | ||
434 | //Console.WriteLine("terraform: number of parcel data blocks" + modify.ParcelData.Length); | ||
435 | |||
436 | switch (modify.ModifyBlock.Action) | ||
437 | { | ||
438 | case 1: | ||
439 | if (modify.ParcelData.Length > 0) | ||
440 | { | ||
441 | int mody = (int) modify.ParcelData[0].North; | ||
442 | int modx = (int) modify.ParcelData[0].West; | ||
443 | // Console.WriteLine("height in packet is " + modify.ModifyBlock.Height.ToString()); | ||
444 | // Console.WriteLine("current height at that point is " + this.m_world.LandMap[(mody * 256) + modx].ToString()); | ||
445 | |||
446 | this.m_world.LandMap[(mody * 256) + modx -1 ] += 0.05f; | ||
447 | this.m_world.LandMap[(mody * 256) + modx] += 0.1f; | ||
448 | this.m_world.LandMap[(mody * 256) + modx + 1] += 0.05f; | ||
449 | this.m_world.LandMap[((mody+1) * 256) + modx] += 0.05f; | ||
450 | this.m_world.LandMap[((mody -1) * 256) + modx] += 0.05f; | ||
451 | m_world.RegenerateTerrain(true, modx, mody); | ||
452 | } | ||
453 | break; | ||
454 | case 2: | ||
455 | if (modify.ParcelData.Length > 0) | ||
456 | { | 527 | { |
457 | int mody = (int)modify.ParcelData[0].North; | 528 | replytask.InventoryData.TaskID = ent.uuid; |
458 | int modx = (int)modify.ParcelData[0].West; | 529 | replytask.InventoryData.Serial = 0; |
459 | // Console.WriteLine("height in packet is " + modify.ModifyBlock.Height.ToString()); | 530 | replytask.InventoryData.Filename = new byte[0]; |
460 | // Console.WriteLine("current height at that point is " + this.m_world.LandMap[(mody * 256) + modx].ToString()); | 531 | foundent = true; |
461 | |||
462 | this.m_world.LandMap[(mody * 256) + modx - 1] -= 0.05f; | ||
463 | this.m_world.LandMap[(mody * 256) + modx] -= 0.1f; | ||
464 | this.m_world.LandMap[(mody * 256) + modx + 1] -= 0.05f; | ||
465 | this.m_world.LandMap[((mody + 1) * 256) + modx] -= 0.05f; | ||
466 | this.m_world.LandMap[((mody - 1) * 256) + modx] -= 0.05f; | ||
467 | m_world.RegenerateTerrain(true, modx, mody); | ||
468 | } | 532 | } |
469 | break; | 533 | } |
470 | } | 534 | if (foundent) |
471 | break; | ||
472 | case PacketType.RequestTaskInventory: | ||
473 | // Console.WriteLine(Pack.ToString()); | ||
474 | RequestTaskInventoryPacket requesttask = (RequestTaskInventoryPacket)Pack; | ||
475 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | ||
476 | bool foundent = false; | ||
477 | foreach (Entity ent in m_world.Entities.Values) | ||
478 | { | ||
479 | if (ent.localid == requesttask.InventoryData.LocalID) | ||
480 | { | 535 | { |
481 | replytask.InventoryData.TaskID = ent.uuid; | 536 | this.OutPacket(replytask); |
482 | replytask.InventoryData.Serial = 0; | ||
483 | replytask.InventoryData.Filename = new byte[0]; | ||
484 | foundent = true; | ||
485 | } | 537 | } |
486 | } | 538 | break; |
487 | if (foundent) | 539 | case PacketType.UUIDNameRequest: |
488 | { | 540 | //System.Text.Encoding _enc = System.Text.Encoding.ASCII; |
489 | this.OutPacket(replytask); | 541 | Console.WriteLine(Pack.ToString()); |
490 | } | 542 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)Pack; |
491 | break; | 543 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); |
492 | case PacketType.UUIDNameRequest: | 544 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; |
493 | //System.Text.Encoding _enc = System.Text.Encoding.ASCII; | 545 | |
494 | Console.WriteLine(Pack.ToString()); | 546 | for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) |
495 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket)Pack; | ||
496 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); | ||
497 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; | ||
498 | |||
499 | for (int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) | ||
500 | { | ||
501 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | ||
502 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; | ||
503 | nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("Who\0"); //for now send any name | ||
504 | nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("Knows\0"); //in future need to look it up | ||
505 | } | ||
506 | this.OutPacket(nameReply); | ||
507 | break; | ||
508 | case PacketType.AgentAnimation: | ||
509 | //Console.WriteLine(Pack.ToString()); | ||
510 | break; | ||
511 | case PacketType.ObjectSelect: | ||
512 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
513 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
514 | { | ||
515 | foreach (Entity ent in m_world.Entities.Values) | ||
516 | { | 547 | { |
517 | if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID) | 548 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); |
549 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; | ||
550 | nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("Who\0"); //for now send any name | ||
551 | nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("Knows\0"); //in future need to look it up | ||
552 | } | ||
553 | this.OutPacket(nameReply); | ||
554 | break; | ||
555 | case PacketType.AgentAnimation: | ||
556 | //Console.WriteLine(Pack.ToString()); | ||
557 | break; | ||
558 | case PacketType.ObjectSelect: | ||
559 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | ||
560 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | ||
561 | { | ||
562 | foreach (Entity ent in m_world.Entities.Values) | ||
518 | { | 563 | { |
519 | ((OpenSim.world.Primitive)ent).GetProperites(this); | 564 | if (ent.localid == incomingselect.ObjectData[i].ObjectLocalID) |
520 | break; | 565 | { |
566 | ((OpenSim.world.Primitive)ent).GetProperites(this); | ||
567 | break; | ||
568 | } | ||
521 | } | 569 | } |
522 | } | 570 | } |
523 | } | 571 | break; |
524 | break; | 572 | |
525 | 573 | ||
526 | 574 | } | |
527 | } | 575 | } |
528 | } | 576 | } |
529 | 577 | ||
@@ -676,7 +724,7 @@ namespace OpenSim | |||
676 | 724 | ||
677 | } | 725 | } |
678 | 726 | ||
679 | public virtual void InPacket(Packet NewPack) | 727 | public virtual void InPacket(Packet NewPack) |
680 | { | 728 | { |
681 | // Handle appended ACKs | 729 | // Handle appended ACKs |
682 | if (NewPack.Header.AppendedAcks) | 730 | if (NewPack.Header.AppendedAcks) |
@@ -738,13 +786,13 @@ namespace OpenSim | |||
738 | m_application = application; | 786 | m_application = application; |
739 | m_inventoryCache = inventoryCache; | 787 | m_inventoryCache = inventoryCache; |
740 | m_sandboxMode = sandboxMode; | 788 | m_sandboxMode = sandboxMode; |
741 | 789 | ||
742 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); | 790 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); |
743 | cirpack = initialcirpack; | 791 | cirpack = initialcirpack; |
744 | userEP = remoteEP; | 792 | userEP = remoteEP; |
745 | PacketQueue = new BlockingQueue<QueItem>(); | 793 | PacketQueue = new BlockingQueue<QueItem>(); |
746 | 794 | ||
747 | this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache ); | 795 | this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache); |
748 | AckTimer = new System.Timers.Timer(500); | 796 | AckTimer = new System.Timers.Timer(500); |
749 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | 797 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); |
750 | AckTimer.Start(); | 798 | AckTimer.Start(); |
@@ -776,10 +824,10 @@ namespace OpenSim | |||
776 | protected virtual void InitNewClient() | 824 | protected virtual void InitNewClient() |
777 | { | 825 | { |
778 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); | 826 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); |
779 | 827 | ||
780 | m_world.AddViewerAgent(this); | 828 | m_world.AddViewerAgent(this); |
781 | world.Entity tempent = m_world.Entities[this.AgentID]; | 829 | world.Entity tempent = m_world.Entities[this.AgentID]; |
782 | 830 | ||
783 | this.ClientAvatar = (world.Avatar)tempent; | 831 | this.ClientAvatar = (world.Avatar)tempent; |
784 | } | 832 | } |
785 | 833 | ||
@@ -872,7 +920,7 @@ namespace OpenSim | |||
872 | asset.Type = packet.InventoryBlock.Type; | 920 | asset.Type = packet.InventoryBlock.Type; |
873 | asset.FullID = LLUUID.Random(); | 921 | asset.FullID = LLUUID.Random(); |
874 | asset.Data = new byte[0]; | 922 | asset.Data = new byte[0]; |
875 | 923 | ||
876 | m_assetCache.AddAsset(asset); | 924 | m_assetCache.AddAsset(asset); |
877 | m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); | 925 | m_inventoryCache.AddNewInventoryItem(this, packet.InventoryBlock.FolderID, asset); |
878 | } | 926 | } |