brokenplugins
parent
8c80d98252
commit
6449e49ea7
|
@ -268,17 +268,16 @@ namespace OpenSim
|
|||
TextureRequest req = new TextureRequest();
|
||||
req.RequestUser = userInfo;
|
||||
req.RequestImage = imageID;
|
||||
req.image_info = imag;
|
||||
req.ImageInfo = imag;
|
||||
|
||||
if(imag.data.LongLength>1000) //should be bigger or smaller?
|
||||
if(imag.data.LongLength>600) //should be bigger or smaller?
|
||||
{
|
||||
//over 1000 bytes so split up file
|
||||
req.num_packets = (int)imag.data.LongLength/1000;
|
||||
req.num_packets++;
|
||||
//over 600 bytes so split up file
|
||||
req.NumPackets = 1 + (int)(imag.data.Length-600+999)/1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
req.num_packets = 1;
|
||||
req.NumPackets = 1;
|
||||
}
|
||||
|
||||
this.TextureRequests.Add(req);
|
||||
|
@ -312,32 +311,54 @@ namespace OpenSim
|
|||
{
|
||||
req=(TextureRequest)this.TextureRequests[i];
|
||||
|
||||
if(req.packet_counter == 0)
|
||||
if(req.PacketCounter == 0)
|
||||
{
|
||||
//first time for this request so send imagedata packet
|
||||
if(req.num_packets == 1)
|
||||
if(req.NumPackets == 1)
|
||||
{
|
||||
//only one packet so send whole file
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = 1;
|
||||
im.ImageID.ID = req.image_info.FullID;
|
||||
im.ImageID.Size = (uint)req.image_info.data.Length;
|
||||
im.ImageData.Data = req.image_info.data;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.data.Length;
|
||||
im.ImageData.Data = req.ImageInfo.data;
|
||||
im.ImageID.Codec = 2;
|
||||
_server.SendPacket(im, true, req.RequestUser);
|
||||
req.packet_counter++;
|
||||
req.image_info.last_used = time;
|
||||
System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||
req.PacketCounter++;
|
||||
req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||
}
|
||||
else
|
||||
{
|
||||
//more than one packet so split file up
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = (ushort)req.NumPackets;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.data.Length;
|
||||
im.ImageData.Data = new byte[600];
|
||||
Array.Copy(req.ImageInfo.data, 0, im.ImageData.Data, 0, 600);
|
||||
im.ImageID.Codec = 2;
|
||||
_server.SendPacket(im, true, req.RequestUser);
|
||||
req.PacketCounter++;
|
||||
req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent first packet of texture:
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//send imagepacket
|
||||
|
||||
//send imagepacket
|
||||
//more than one packet so split file up
|
||||
ImagePacketPacket im = new ImagePacketPacket();
|
||||
im.ImageID.Packet = (ushort)req.PacketCounter;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
int size = req.ImageInfo.data.Length - 600 - 1000*(req.PacketCounter - 1);
|
||||
if(size > 1000) size = 1000;
|
||||
im.ImageData.Data = new byte[size];
|
||||
Array.Copy(req.ImageInfo.data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size);
|
||||
_server.SendPacket(im, true, req.RequestUser);
|
||||
req.PacketCounter++;
|
||||
req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,7 +366,7 @@ namespace OpenSim
|
|||
for(int i = 0; i < num; i++)
|
||||
{
|
||||
req=(TextureRequest)this.TextureRequests[i];
|
||||
if(req.packet_counter == req.num_packets)
|
||||
if(req.PacketCounter == req.NumPackets)
|
||||
{
|
||||
this.TextureRequests.Remove(req);
|
||||
}
|
||||
|
@ -418,10 +439,10 @@ namespace OpenSim
|
|||
{
|
||||
public UserAgentInfo RequestUser;
|
||||
public LLUUID RequestImage;
|
||||
public TextureImage image_info;
|
||||
public long data_pointer = 0;
|
||||
public int num_packets = 0;
|
||||
public int packet_counter = 0;
|
||||
public TextureImage ImageInfo;
|
||||
public long DataPointer = 0;
|
||||
public int NumPackets = 0;
|
||||
public int PacketCounter = 0;
|
||||
|
||||
public TextureRequest()
|
||||
{
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace OpenSim
|
|||
private LoginManager _loginManager; //built in login server
|
||||
private ulong time; //ticks
|
||||
private Timer timer1 = new Timer();
|
||||
|
||||
|
||||
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||
|
||||
public Controller() {
|
||||
_login = new Logon(); // should create a list for these.
|
||||
_server = new Server( this );
|
||||
|
@ -120,6 +120,22 @@ namespace OpenSim
|
|||
this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
||||
|
||||
}
|
||||
else if( pack.Type == PacketType.UUIDNameRequest)
|
||||
{
|
||||
UUIDNameRequestPacket nameRequest = (UUIDNameRequestPacket) pack;
|
||||
UUIDNameReplyPacket nameReply = new UUIDNameReplyPacket();
|
||||
nameReply.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[nameRequest.UUIDNameBlock.Length];
|
||||
|
||||
for(int i = 0; i < nameRequest.UUIDNameBlock.Length; i++)
|
||||
{
|
||||
nameReply.UUIDNameBlock[i] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
|
||||
nameReply.UUIDNameBlock[i].ID = nameRequest.UUIDNameBlock[i].ID;
|
||||
nameReply.UUIDNameBlock[i].FirstName = _enc.GetBytes("harry \0"); //for now send any name
|
||||
nameReply.UUIDNameBlock[i].LastName = _enc.GetBytes("tom \0"); //in future need to look it up
|
||||
}
|
||||
|
||||
_server.SendPacket(nameReply, true, userInfo);
|
||||
}
|
||||
else if(pack.Type == PacketType.CloseCircuit)
|
||||
{
|
||||
this._agentManager.RemoveAgent(userInfo);
|
||||
|
|
Loading…
Reference in New Issue