From 32438ab1b9a5c270e0a4a2d708f8c7730dc7e617 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sun, 30 Dec 2007 06:18:17 +0000
Subject: * This update rolls back the packetpool and LibSL changes. Please
retest and then patch these changes back in. Currently it's not quite ready
for 0.5. The down side to this action, is that we loose some performance to
the garbage collector for now. Given that the target date for 0.5 is *Two
days* from now, I'm taking the initiative to work towards a real stable
version. * This update also fixes scripting and some weird physics reactions
---
OpenSim/Region/ClientStack/ClientView.cs | 178 +++++++++++++++----------------
1 file changed, 88 insertions(+), 90 deletions(-)
(limited to 'OpenSim/Region/ClientStack/ClientView.cs')
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 932414d..8bf807c 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack
{
m_scene.RemoveClient(AgentId);
// Send the STOP packet
- DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
+ DisableSimulatorPacket disable = new DisableSimulatorPacket();
OutPacket(disable, ThrottleOutPacketType.Task);
@@ -257,7 +257,7 @@ namespace OpenSim.Region.ClientStack
public void Kick(string message)
{
- KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser);
+ KickUserPacket kupack = new KickUserPacket();
kupack.UserInfo.AgentID = AgentId;
kupack.UserInfo.SessionID = SessionId;
kupack.TargetBlock.TargetIP = (uint) 0;
@@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack
///
public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
{
- AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
+ AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.SimData.ChannelVersion = m_channelVersion;
mov.AgentData.SessionID = m_sessionId;
mov.AgentData.AgentID = AgentId;
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
- ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
+ ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
reply.ChatData.Audible = 1;
reply.ChatData.Message = message;
reply.ChatData.ChatType = type;
@@ -652,7 +652,7 @@ namespace OpenSim.Region.ClientStack
public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
{
- ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
+ ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket();
msg.AgentData.AgentID = fromAgent;
msg.AgentData.SessionID = fromAgentSession;
msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -740,7 +740,7 @@ namespace OpenSim.Region.ClientStack
IPAddress neighbourIP = neighbourEndPoint.Address;
ushort neighbourPort = (ushort) neighbourEndPoint.Port;
- EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator);
+ EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
// TODO: don't create new blocks if recycling an old packet
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
@@ -777,7 +777,7 @@ namespace OpenSim.Region.ClientStack
{
LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10);
- CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion);
+ CrossedRegionPacket newSimPack = new CrossedRegionPacket();
// TODO: don't create new blocks if recycling an old packet
newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
newSimPack.AgentData.AgentID = AgentId;
@@ -800,7 +800,7 @@ namespace OpenSim.Region.ClientStack
public void SendMapBlock(List mapBlocks)
{
- MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply);
+ MapBlockReplyPacket mapReply = new MapBlockReplyPacket();
// TODO: don't create new blocks if recycling an old packet
mapReply.AgentData.AgentID = AgentId;
mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
@@ -823,7 +823,7 @@ namespace OpenSim.Region.ClientStack
public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
{
- TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
+ TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = AgentId;
tpLocal.Info.TeleportFlags = flags;
tpLocal.Info.LocationID = 2;
@@ -835,7 +835,7 @@ namespace OpenSim.Region.ClientStack
public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
uint flags, string capsURL)
{
- TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish);
+ TeleportFinishPacket teleport = new TeleportFinishPacket();
teleport.Info.AgentID = AgentId;
teleport.Info.RegionHandle = regionHandle;
teleport.Info.SimAccess = simAccess;
@@ -861,7 +861,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendTeleportFailed()
{
- TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
+ TeleportFailedPacket tpFailed = new TeleportFailedPacket();
tpFailed.Info.AgentID = AgentId;
tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
OutPacket(tpFailed, ThrottleOutPacketType.Task);
@@ -872,14 +872,14 @@ namespace OpenSim.Region.ClientStack
///
public void SendTeleportLocationStart()
{
- TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
+ TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 16; // Teleport via location
OutPacket(tpStart, ThrottleOutPacketType.Task);
}
public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
{
- MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
+ MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket();
money.MoneyData.AgentID = AgentId;
money.MoneyData.TransactionID = transaction;
money.MoneyData.TransactionSuccess = success;
@@ -890,7 +890,7 @@ namespace OpenSim.Region.ClientStack
public void SendStartPingCheck(byte seq)
{
- StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
+ StartPingCheckPacket pc = new StartPingCheckPacket();
pc.PingID.PingID = seq;
pc.Header.Reliable = false;
OutPacket(pc, ThrottleOutPacketType.Task);
@@ -898,7 +898,7 @@ namespace OpenSim.Region.ClientStack
public void SendKillObject(ulong regionHandle, uint localID)
{
- KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject);
+ KillObjectPacket kill = new KillObjectPacket();
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@@ -1092,7 +1092,7 @@ namespace OpenSim.Region.ClientStack
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
{
- InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents);
+ InventoryDescendentsPacket descend = new InventoryDescendentsPacket();
descend.AgentData.AgentID = AgentId;
descend.AgentData.OwnerID = ownerID;
descend.AgentData.FolderID = folderID;
@@ -1105,7 +1105,7 @@ namespace OpenSim.Region.ClientStack
{
Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647;
- FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
+ FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket();
// TODO: don't create new blocks if recycling an old packet
inventoryReply.AgentData.AgentID = AgentId;
inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
@@ -1147,7 +1147,7 @@ namespace OpenSim.Region.ClientStack
{
Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647;
- UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
+ UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket();
// TODO: don't create new blocks if recycling an old packet
InventoryReply.AgentData.AgentID = AgentId;
InventoryReply.AgentData.SimApproved = true;
@@ -1186,7 +1186,7 @@ namespace OpenSim.Region.ClientStack
public void SendRemoveInventoryItem(LLUUID itemID)
{
- RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem);
+ RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket();
// TODO: don't create new blocks if recycling an old packet
remove.AgentData.AgentID = AgentId;
remove.AgentData.SessionID = m_sessionId;
@@ -1199,7 +1199,7 @@ namespace OpenSim.Region.ClientStack
public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
{
- ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory);
+ ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket();
replytask.InventoryData.TaskID = taskID;
replytask.InventoryData.Serial = serial;
replytask.InventoryData.Filename = fileName;
@@ -1208,7 +1208,7 @@ namespace OpenSim.Region.ClientStack
public void SendXferPacket(ulong xferID, uint packet, byte[] data)
{
- SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
+ SendXferPacketPacket sendXfer = new SendXferPacketPacket();
sendXfer.XferID.ID = xferID;
sendXfer.XferID.Packet = packet;
sendXfer.DataPacket.Data = data;
@@ -1226,7 +1226,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAlertMessage(string message)
{
- AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage);
+ AlertMessagePacket alertPack = new AlertMessagePacket();
alertPack.AlertData.Message = Helpers.StringToField(message);
OutPacket(alertPack, ThrottleOutPacketType.Task);
}
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAgentAlertMessage(string message, bool modal)
{
- AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
+ AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket();
alertPack.AgentData.AgentID = AgentId;
alertPack.AlertData.Message = Helpers.StringToField(message);
alertPack.AlertData.Modal = modal;
@@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ClientStack
public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
string url)
{
- LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL);
+ LoadURLPacket loadURL = new LoadURLPacket();
loadURL.Data.ObjectName = Helpers.StringToField(objectname);
loadURL.Data.ObjectID = objectID;
loadURL.Data.OwnerID = ownerID;
@@ -1274,7 +1274,7 @@ namespace OpenSim.Region.ClientStack
public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
{
- AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound);
+ AttachedSoundPacket sound = new AttachedSoundPacket();
sound.DataBlock.SoundID = soundID;
sound.DataBlock.ObjectID = objectID;
sound.DataBlock.OwnerID = ownerID;
@@ -1286,7 +1286,7 @@ namespace OpenSim.Region.ClientStack
public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
{
- SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
+ SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
viewertime.TimeInfo.SunDirection = sunPos;
viewertime.TimeInfo.SunAngVelocity = sunVel;
viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch();
@@ -1296,7 +1296,7 @@ namespace OpenSim.Region.ClientStack
public void SendViewerTime(int phase)
{
Console.WriteLine("SunPhase: {0}", phase);
- SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
+ SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
//viewertime.TimeInfo.SecPerDay = 86400;
//viewertime.TimeInfo.SecPerYear = 31536000;
viewertime.TimeInfo.SecPerDay = 1000;
@@ -1345,7 +1345,7 @@ namespace OpenSim.Region.ClientStack
string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
LLUUID partnerID)
{
- AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply);
+ AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket();
avatarReply.AgentData.AgentID = AgentId;
avatarReply.AgentData.AvatarID = avatarID;
avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
@@ -1370,7 +1370,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendWearables(AvatarWearable[] wearables, int serial)
{
- AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
+ AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = AgentId;
aw.AgentData.SerialNum = (uint) serial;
aw.AgentData.SessionID = m_sessionId;
@@ -1398,7 +1398,7 @@ namespace OpenSim.Region.ClientStack
///
public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
{
- AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
+ AvatarAppearancePacket avp = new AvatarAppearancePacket();
// TODO: don't create new blocks if recycling an old packet
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
avp.ObjectData.TextureEntry = textureEntry;
@@ -1418,7 +1418,7 @@ namespace OpenSim.Region.ClientStack
public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
{
- AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
+ AvatarAnimationPacket ani = new AvatarAnimationPacket();
// TODO: don't create new blocks if recycling an old packet
ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
@@ -1453,7 +1453,7 @@ namespace OpenSim.Region.ClientStack
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
{
- ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
+ ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
objupdate.RegionData.RegionHandle = regionHandle;
objupdate.RegionData.TimeDilation = 64096;
@@ -1486,7 +1486,7 @@ namespace OpenSim.Region.ClientStack
{
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
CreateAvatarImprovedBlock(localID, position, velocity, rotation);
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1498,7 +1498,7 @@ namespace OpenSim.Region.ClientStack
public void SendCoarseLocationUpdate(List CoarseLocations)
{
- CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
+ CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
int total = CoarseLocations.Count;
CoarseLocationUpdatePacket.IndexBlock ib =
@@ -1531,7 +1531,7 @@ namespace OpenSim.Region.ClientStack
///
public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
{
- ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
+ ObjectAttachPacket attach = new ObjectAttachPacket();
// TODO: don't create new blocks if recycling an old packet
attach.AgentData.AgentID = AgentId;
attach.AgentData.SessionID = m_sessionId;
@@ -1551,7 +1551,7 @@ namespace OpenSim.Region.ClientStack
LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
LLQuaternion rotation, byte clickAction)
{
- ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
+ ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
outPacket.RegionData.RegionHandle = regionHandle;
outPacket.RegionData.TimeDilation = timeDilation;
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.ClientStack
{
LLVector3 velocity = new LLVector3(0f, 0f, 0f);
LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1608,7 +1608,7 @@ namespace OpenSim.Region.ClientStack
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
{
- ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
// TODO: don't create new blocks if recycling an old packet
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
@@ -1946,8 +1946,8 @@ namespace OpenSim.Region.ClientStack
public void SendNameReply(LLUUID profileId, string firstname, string lastname)
{
- UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply);
- // TODO: don't create new blocks if recycling an old packet
+ UUIDNameReplyPacket packet = new UUIDNameReplyPacket();
+
packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
packet.UUIDNameBlock[0].ID = profileId;
@@ -1995,7 +1995,7 @@ namespace OpenSim.Region.ClientStack
{
//System.Console.WriteLine("texture cached: " + packet.ToString());
AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
- AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
+ AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket();
// TODO: don't create new blocks if recycling an old packet
cachedresp.AgentData.AgentID = AgentId;
cachedresp.AgentData.SessionID = m_sessionId;
@@ -2156,7 +2156,7 @@ namespace OpenSim.Region.ClientStack
{
//should be getting the map layer from the grid server
//send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
- MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply);
+ MapLayerReplyPacket mapReply = new MapLayerReplyPacket();
// TODO: don't create new blocks if recycling an old packet
mapReply.AgentData.AgentID = AgentId;
mapReply.AgentData.Flags = 0;
@@ -2301,18 +2301,22 @@ namespace OpenSim.Region.ClientStack
// Actually make the byte array and send it
try
{
- byte[] sendbuffer = Pack.ToBytes();
- PacketPool.Instance.ReturnPacket(Pack);
-
- if (Pack.Header.Zerocoded)
- {
- int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
- m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
- }
- else
- {
- m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
- }
+ byte[] sendbuffer = Pack.ToBytes();
+ if (Pack is RegionHandshakePacket)
+ {
+ PacketPool.Instance.ReturnPacket(Pack);
+ }
+
+ if (Pack.Header.Zerocoded)
+ {
+ byte[] ZeroOutBuffer = new byte[4096];
+ int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
+ m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
+ }
+ else
+ {
+ m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
+ }
}
catch (Exception e)
{
@@ -2358,7 +2362,7 @@ namespace OpenSim.Region.ClientStack
{
//reply to pingcheck
StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
- CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
+ CompletePingCheckPacket endPing = new CompletePingCheckPacket();
endPing.PingID.PingID = startPing.PingID.PingID;
OutPacket(endPing, ThrottleOutPacketType.Task);
}
@@ -2387,7 +2391,7 @@ namespace OpenSim.Region.ClientStack
{
if (Pack.Header.Reliable)
{
- PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
+ PacketAckPacket ack_it = new PacketAckPacket();
// TODO: don't create new blocks if recycling an old packet
ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
@@ -2443,7 +2447,7 @@ namespace OpenSim.Region.ClientStack
//MainLog.Instance.Verbose("NETWORK", "Sending PacketAck");
int i = 0;
- PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
+ PacketAckPacket acks = new PacketAckPacket();
// TODO: don't create new blocks if recycling an old packet
acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count];
@@ -2540,14 +2544,6 @@ namespace OpenSim.Region.ClientStack
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket) Pack;
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
string IMmessage = Helpers.FieldToUTF8String(msgpack.MessageBlock.Message);
- //byte[] msgpack.MessageBlock.BinaryBucket;
- //bool msgpack.MessageBlock.FromGroup;
-
- //byte msgpack.MessageBlock.Offline;
- //uint msgpack.MessageBlock.ParentEstateID;
- //LLVector3 msgpack.MessageBlock.Position;
- //LLUUID msgpack.MessageBlock.RegionID;
-
if (OnInstantMessage != null)
{
OnInstantMessage(msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
@@ -2555,7 +2551,7 @@ namespace OpenSim.Region.ClientStack
msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
- msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
+ msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
msgpack.MessageBlock.BinaryBucket);
}
break;
@@ -2571,19 +2567,14 @@ namespace OpenSim.Region.ClientStack
//rezPacket.RezData.RemoveItem;
//rezPacket.RezData.RezSelected;
//rezPacket.RezData.FromTaskID;
- //rezPacket.RezData.FromTaskID;
- //rezPacket.RezData.EveryoneMask;
- //rezPacket.RezData.GroupMask;
- //rezPacket.RezData.NextOwnerMask;
-
//MainLog.Instance.Verbose("REZData", rezPacket.ToString());
- OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
- rezPacket.RezData.RayStart,rezPacket.RezData.RayTargetID,
- rezPacket.RezData.BypassRaycast,rezPacket.RezData.RayEndIsIntersection,
- rezPacket.RezData.EveryoneMask,rezPacket.RezData.GroupMask,
- rezPacket.RezData.NextOwnerMask,rezPacket.RezData.ItemFlags,
- rezPacket.RezData.RezSelected,rezPacket.RezData.RemoveItem,
- rezPacket.RezData.FromTaskID);
+ OnRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
+ rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
+ rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
+ rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask,
+ rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags,
+ rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
+ rezPacket.RezData.FromTaskID);
}
break;
case PacketType.DeRezObject:
@@ -2762,6 +2753,12 @@ namespace OpenSim.Region.ClientStack
{
ObjectAddPacket addPacket = (ObjectAddPacket) Pack;
PrimitiveBaseShape shape = GetShapeFromAddPacket(addPacket);
+ MainLog.Instance.Verbose("REZData", addPacket.ToString());
+ //BypassRaycast: 1
+ //RayStart: <69.79469, 158.2652, 98.40343>
+ //RayEnd: <61.97724, 141.995, 92.58341>
+ //RayTargetID: 00000000-0000-0000-0000-000000000000
+
OnAddPrim(AgentId, addPacket.ObjectData.RayEnd, addPacket.ObjectData.Rotation, shape,addPacket.ObjectData.BypassRaycast,addPacket.ObjectData.RayStart,addPacket.ObjectData.RayTargetID,addPacket.ObjectData.RayEndIsIntersection);
}
break;
@@ -2884,9 +2881,10 @@ namespace OpenSim.Region.ClientStack
break;
case PacketType.ObjectPermissions:
MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString());
- ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
+ ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack;
- List permChanges = new List();
+ List permChanges =
+ new List();
for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
{
@@ -2916,7 +2914,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.RequestObjectPropertiesFamily:
//This powers the little tooltip that appears when you move your mouse over an object
- RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack;
+ RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack;
RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
@@ -3020,7 +3018,7 @@ namespace OpenSim.Region.ClientStack
case PacketType.MoveInventoryFolder:
if (OnMoveInventoryFolder != null)
{
- MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack;
+ MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack;
for (int i = 0; i < invFolder.InventoryData.Length; i++)
{
OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID,
@@ -3127,7 +3125,7 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.MoveInventoryItem:
- MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack;
+ MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack;
if (OnMoveInventoryItem != null)
{
foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
@@ -3196,11 +3194,11 @@ namespace OpenSim.Region.ClientStack
case PacketType.TeleportLandmarkRequest:
TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
- TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
+ TeleportStartPacket tpStart = new TeleportStartPacket();
tpStart.Info.TeleportFlags = 8; // tp via lm
OutPacket(tpStart, ThrottleOutPacketType.Task);
- TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
+ TeleportProgressPacket tpProgress = new TeleportProgressPacket();
tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
tpProgress.Info.TeleportFlags = 8;
tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
@@ -3215,7 +3213,7 @@ namespace OpenSim.Region.ClientStack
if (lm.RegionID == m_scene.RegionInfo.RegionID)
{
- TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
+ TeleportLocalPacket tpLocal = new TeleportLocalPacket();
tpLocal.Info.AgentID = tpReq.Info.AgentID;
tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
@@ -3225,7 +3223,7 @@ namespace OpenSim.Region.ClientStack
}
else
{
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3235,7 +3233,7 @@ namespace OpenSim.Region.ClientStack
{
Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.AgentID = tpReq.Info.AgentID;
tpCancel.Info.SessionID = tpReq.Info.SessionID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3253,7 +3251,7 @@ namespace OpenSim.Region.ClientStack
else
{
//no event handler so cancel request
- TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
+ TeleportCancelPacket tpCancel = new TeleportCancelPacket();
tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3561,7 +3559,7 @@ namespace OpenSim.Region.ClientStack
public void SendLogoutPacket()
{
- LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply);
+ LogoutReplyPacket logReply = new LogoutReplyPacket();
// TODO: don't create new blocks if recycling an old packet
logReply.AgentData.AgentID = AgentId;
logReply.AgentData.SessionID = SessionId;
--
cgit v1.1