diff options
-rw-r--r-- | AssetManagement.cs | 63 | ||||
-rw-r--r-- | Controller.cs | 20 |
2 files changed, 60 insertions, 23 deletions
diff --git a/AssetManagement.cs b/AssetManagement.cs index 07b2b57..ad63733 100644 --- a/AssetManagement.cs +++ b/AssetManagement.cs | |||
@@ -268,17 +268,16 @@ namespace OpenSim | |||
268 | TextureRequest req = new TextureRequest(); | 268 | TextureRequest req = new TextureRequest(); |
269 | req.RequestUser = userInfo; | 269 | req.RequestUser = userInfo; |
270 | req.RequestImage = imageID; | 270 | req.RequestImage = imageID; |
271 | req.image_info = imag; | 271 | req.ImageInfo = imag; |
272 | 272 | ||
273 | if(imag.data.LongLength>1000) //should be bigger or smaller? | 273 | if(imag.data.LongLength>600) //should be bigger or smaller? |
274 | { | 274 | { |
275 | //over 1000 bytes so split up file | 275 | //over 600 bytes so split up file |
276 | req.num_packets = (int)imag.data.LongLength/1000; | 276 | req.NumPackets = 1 + (int)(imag.data.Length-600+999)/1000; |
277 | req.num_packets++; | ||
278 | } | 277 | } |
279 | else | 278 | else |
280 | { | 279 | { |
281 | req.num_packets = 1; | 280 | req.NumPackets = 1; |
282 | } | 281 | } |
283 | 282 | ||
284 | this.TextureRequests.Add(req); | 283 | this.TextureRequests.Add(req); |
@@ -312,32 +311,54 @@ namespace OpenSim | |||
312 | { | 311 | { |
313 | req=(TextureRequest)this.TextureRequests[i]; | 312 | req=(TextureRequest)this.TextureRequests[i]; |
314 | 313 | ||
315 | if(req.packet_counter == 0) | 314 | if(req.PacketCounter == 0) |
316 | { | 315 | { |
317 | //first time for this request so send imagedata packet | 316 | //first time for this request so send imagedata packet |
318 | if(req.num_packets == 1) | 317 | if(req.NumPackets == 1) |
319 | { | 318 | { |
320 | //only one packet so send whole file | 319 | //only one packet so send whole file |
321 | ImageDataPacket im = new ImageDataPacket(); | 320 | ImageDataPacket im = new ImageDataPacket(); |
322 | im.ImageID.Packets = 1; | 321 | im.ImageID.Packets = 1; |
323 | im.ImageID.ID = req.image_info.FullID; | 322 | im.ImageID.ID = req.ImageInfo.FullID; |
324 | im.ImageID.Size = (uint)req.image_info.data.Length; | 323 | im.ImageID.Size = (uint)req.ImageInfo.data.Length; |
325 | im.ImageData.Data = req.image_info.data; | 324 | im.ImageData.Data = req.ImageInfo.data; |
326 | im.ImageID.Codec = 2; | 325 | im.ImageID.Codec = 2; |
327 | _server.SendPacket(im, true, req.RequestUser); | 326 | _server.SendPacket(im, true, req.RequestUser); |
328 | req.packet_counter++; | 327 | req.PacketCounter++; |
329 | req.image_info.last_used = time; | 328 | req.ImageInfo.last_used = time; |
330 | System.Console.WriteLine("sent texture: "+req.image_info.FullID); | 329 | //System.Console.WriteLine("sent texture: "+req.image_info.FullID); |
331 | } | 330 | } |
332 | else | 331 | else |
333 | { | 332 | { |
334 | //more than one packet so split file up | 333 | //more than one packet so split file up |
334 | ImageDataPacket im = new ImageDataPacket(); | ||
335 | im.ImageID.Packets = (ushort)req.NumPackets; | ||
336 | im.ImageID.ID = req.ImageInfo.FullID; | ||
337 | im.ImageID.Size = (uint)req.ImageInfo.data.Length; | ||
338 | im.ImageData.Data = new byte[600]; | ||
339 | Array.Copy(req.ImageInfo.data, 0, im.ImageData.Data, 0, 600); | ||
340 | im.ImageID.Codec = 2; | ||
341 | _server.SendPacket(im, true, req.RequestUser); | ||
342 | req.PacketCounter++; | ||
343 | req.ImageInfo.last_used = time; | ||
344 | //System.Console.WriteLine("sent first packet of texture: | ||
335 | } | 345 | } |
336 | } | 346 | } |
337 | else | 347 | else |
338 | { | 348 | { |
339 | //send imagepacket | 349 | //send imagepacket |
340 | 350 | //more than one packet so split file up | |
351 | ImagePacketPacket im = new ImagePacketPacket(); | ||
352 | im.ImageID.Packet = (ushort)req.PacketCounter; | ||
353 | im.ImageID.ID = req.ImageInfo.FullID; | ||
354 | int size = req.ImageInfo.data.Length - 600 - 1000*(req.PacketCounter - 1); | ||
355 | if(size > 1000) size = 1000; | ||
356 | im.ImageData.Data = new byte[size]; | ||
357 | Array.Copy(req.ImageInfo.data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size); | ||
358 | _server.SendPacket(im, true, req.RequestUser); | ||
359 | req.PacketCounter++; | ||
360 | req.ImageInfo.last_used = time; | ||
361 | //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID); | ||
341 | } | 362 | } |
342 | } | 363 | } |
343 | 364 | ||
@@ -345,7 +366,7 @@ namespace OpenSim | |||
345 | for(int i = 0; i < num; i++) | 366 | for(int i = 0; i < num; i++) |
346 | { | 367 | { |
347 | req=(TextureRequest)this.TextureRequests[i]; | 368 | req=(TextureRequest)this.TextureRequests[i]; |
348 | if(req.packet_counter == req.num_packets) | 369 | if(req.PacketCounter == req.NumPackets) |
349 | { | 370 | { |
350 | this.TextureRequests.Remove(req); | 371 | this.TextureRequests.Remove(req); |
351 | } | 372 | } |
@@ -418,10 +439,10 @@ namespace OpenSim | |||
418 | { | 439 | { |
419 | public UserAgentInfo RequestUser; | 440 | public UserAgentInfo RequestUser; |
420 | public LLUUID RequestImage; | 441 | public LLUUID RequestImage; |
421 | public TextureImage image_info; | 442 | public TextureImage ImageInfo; |
422 | public long data_pointer = 0; | 443 | public long DataPointer = 0; |
423 | public int num_packets = 0; | 444 | public int NumPackets = 0; |
424 | public int packet_counter = 0; | 445 | public int PacketCounter = 0; |
425 | 446 | ||
426 | public TextureRequest() | 447 | public TextureRequest() |
427 | { | 448 | { |
diff --git a/Controller.cs b/Controller.cs index 6282ce3..b7112f1 100644 --- a/Controller.cs +++ b/Controller.cs | |||
@@ -64,8 +64,8 @@ namespace OpenSim | |||
64 | private LoginManager _loginManager; //built in login server | 64 | private LoginManager _loginManager; //built in login server |
65 | private ulong time; //ticks | 65 | private ulong time; //ticks |
66 | private Timer timer1 = new Timer(); | 66 | private Timer timer1 = new Timer(); |
67 | 67 | private System.Text.Encoding _enc = System.Text.Encoding.ASCII; | |
68 | 68 | ||
69 | public Controller() { | 69 | public Controller() { |
70 | _login = new Logon(); // should create a list for these. | 70 | _login = new Logon(); // should create a list for these. |
71 | _server = new Server( this ); | 71 | _server = new Server( this ); |
@@ -120,6 +120,22 @@ namespace OpenSim | |||
120 | this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); | 120 | this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); |
121 | 121 | ||
122 | } | 122 | } |
123 | else if( pack.Type == PacketType.UUIDNameRequest) | ||
124 | { | ||
125 | UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket) pack; | ||
126 | UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket(); | ||
127 | nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length]; | ||
128 | |||
129 | for(int i = 0; i < nameRequest.UUIDNameBlock.Length; i++) | ||
130 | { | ||
131 | nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | ||
132 | nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID; | ||
133 | nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("harry \0"); //for now send any name | ||
134 | nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("tom \0"); //in future need to look it up | ||
135 | } | ||
136 | |||
137 | _server.SendPacket(nameReply, true, userInfo); | ||
138 | } | ||
123 | else if(pack.Type == PacketType.CloseCircuit) | 139 | else if(pack.Type == PacketType.CloseCircuit) |
124 | { | 140 | { |
125 | this._agentManager.RemoveAgent(userInfo); | 141 | this._agentManager.RemoveAgent(userInfo); |