brokenplugins
parent
8c80d98252
commit
6449e49ea7
|
@ -268,17 +268,16 @@ namespace OpenSim
|
||||||
TextureRequest req = new TextureRequest();
|
TextureRequest req = new TextureRequest();
|
||||||
req.RequestUser = userInfo;
|
req.RequestUser = userInfo;
|
||||||
req.RequestImage = imageID;
|
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
|
//over 600 bytes so split up file
|
||||||
req.num_packets = (int)imag.data.LongLength/1000;
|
req.NumPackets = 1 + (int)(imag.data.Length-600+999)/1000;
|
||||||
req.num_packets++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
req.num_packets = 1;
|
req.NumPackets = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.TextureRequests.Add(req);
|
this.TextureRequests.Add(req);
|
||||||
|
@ -312,32 +311,54 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
req=(TextureRequest)this.TextureRequests[i];
|
req=(TextureRequest)this.TextureRequests[i];
|
||||||
|
|
||||||
if(req.packet_counter == 0)
|
if(req.PacketCounter == 0)
|
||||||
{
|
{
|
||||||
//first time for this request so send imagedata packet
|
//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
|
//only one packet so send whole file
|
||||||
ImageDataPacket im = new ImageDataPacket();
|
ImageDataPacket im = new ImageDataPacket();
|
||||||
im.ImageID.Packets = 1;
|
im.ImageID.Packets = 1;
|
||||||
im.ImageID.ID = req.image_info.FullID;
|
im.ImageID.ID = req.ImageInfo.FullID;
|
||||||
im.ImageID.Size = (uint)req.image_info.data.Length;
|
im.ImageID.Size = (uint)req.ImageInfo.data.Length;
|
||||||
im.ImageData.Data = req.image_info.data;
|
im.ImageData.Data = req.ImageInfo.data;
|
||||||
im.ImageID.Codec = 2;
|
im.ImageID.Codec = 2;
|
||||||
_server.SendPacket(im, true, req.RequestUser);
|
_server.SendPacket(im, true, req.RequestUser);
|
||||||
req.packet_counter++;
|
req.PacketCounter++;
|
||||||
req.image_info.last_used = time;
|
req.ImageInfo.last_used = time;
|
||||||
System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
//System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//more than one packet so split file up
|
//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
|
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++)
|
for(int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
req=(TextureRequest)this.TextureRequests[i];
|
req=(TextureRequest)this.TextureRequests[i];
|
||||||
if(req.packet_counter == req.num_packets)
|
if(req.PacketCounter == req.NumPackets)
|
||||||
{
|
{
|
||||||
this.TextureRequests.Remove(req);
|
this.TextureRequests.Remove(req);
|
||||||
}
|
}
|
||||||
|
@ -418,10 +439,10 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
public UserAgentInfo RequestUser;
|
public UserAgentInfo RequestUser;
|
||||||
public LLUUID RequestImage;
|
public LLUUID RequestImage;
|
||||||
public TextureImage image_info;
|
public TextureImage ImageInfo;
|
||||||
public long data_pointer = 0;
|
public long DataPointer = 0;
|
||||||
public int num_packets = 0;
|
public int NumPackets = 0;
|
||||||
public int packet_counter = 0;
|
public int PacketCounter = 0;
|
||||||
|
|
||||||
public TextureRequest()
|
public TextureRequest()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim
|
||||||
private LoginManager _loginManager; //built in login server
|
private LoginManager _loginManager; //built in login server
|
||||||
private ulong time; //ticks
|
private ulong time; //ticks
|
||||||
private Timer timer1 = new Timer();
|
private Timer timer1 = new Timer();
|
||||||
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
|
||||||
public Controller() {
|
public Controller() {
|
||||||
_login = new Logon(); // should create a list for these.
|
_login = new Logon(); // should create a list for these.
|
||||||
|
@ -120,6 +120,22 @@ namespace OpenSim
|
||||||
this._gridManager.RequestMapBlock(userInfo, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
|
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)
|
else if(pack.Type == PacketType.CloseCircuit)
|
||||||
{
|
{
|
||||||
this._agentManager.RemoveAgent(userInfo);
|
this._agentManager.RemoveAgent(userInfo);
|
||||||
|
|
Loading…
Reference in New Issue