* Fixed a null NewPack error in ClientView.InPacket (object pool returning null objects?)

afrisby
Teravus Ovares 2007-12-20 14:44:59 +00:00
parent 76255c4793
commit 2641f78a20
2 changed files with 37 additions and 28 deletions

View File

@ -2217,44 +2217,48 @@ namespace OpenSim.Region.ClientStack
public virtual void InPacket(Packet NewPack) public virtual void InPacket(Packet NewPack)
{ {
// Handle appended ACKs // Handle appended ACKs
if (NewPack.Header.AppendedAcks) if (NewPack != null)
{ {
lock (m_needAck) if (NewPack.Header.AppendedAcks)
{ {
foreach (uint ack in NewPack.Header.AckList) lock (m_needAck)
{ {
m_needAck.Remove(ack); foreach (uint ack in NewPack.Header.AckList)
{
m_needAck.Remove(ack);
}
} }
} }
}
// Handle PacketAck packets // Handle PacketAck packets
if (NewPack.Type == PacketType.PacketAck) if (NewPack.Type == PacketType.PacketAck)
{
PacketAckPacket ackPacket = (PacketAckPacket) NewPack;
lock (m_needAck)
{ {
foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) PacketAckPacket ackPacket = (PacketAckPacket) NewPack;
lock (m_needAck)
{ {
m_needAck.Remove(block.ID); foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
{
m_needAck.Remove(block.ID);
}
} }
} }
} else if ((NewPack.Type == PacketType.StartPingCheck))
else if ((NewPack.Type == PacketType.StartPingCheck)) {
{ //reply to pingcheck
//reply to pingcheck StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; CompletePingCheckPacket endPing = new CompletePingCheckPacket();
CompletePingCheckPacket endPing = new CompletePingCheckPacket(); endPing.PingID.PingID = startPing.PingID.PingID;
endPing.PingID.PingID = startPing.PingID.PingID; OutPacket(endPing, ThrottleOutPacketType.Task);
OutPacket(endPing, ThrottleOutPacketType.Task); }
} else
else {
{ QueItem item = new QueItem();
QueItem item = new QueItem(); item.Packet = NewPack;
item.Packet = NewPack; item.Incoming = true;
item.Incoming = true; m_packetQueue.Enqueue(item);
m_packetQueue.Enqueue(item); }
} }
} }

View File

@ -242,6 +242,9 @@ namespace OpenSim.Region.Environment.LandManagement
if (x >= 64 || y >= 64 || x < 0 || y < 0) if (x >= 64 || y >= 64 || x < 0 || y < 0)
{ {
// These exceptions here will cause a lot of complaints from the users specifically because
// they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y); throw new Exception("Error: Parcel not found at point " + x + ", " + y);
} }
else else
@ -255,6 +258,8 @@ namespace OpenSim.Region.Environment.LandManagement
{ {
if (x >= 256 || y >= 256 || x < 0 || y < 0) if (x >= 256 || y >= 256 || x < 0 || y < 0)
{ {
// These exceptions here will cause a lot of complaints from the users specifically because
// they happen every time at border crossings
throw new Exception("Error: Parcel not found at point " + x + ", " + y); throw new Exception("Error: Parcel not found at point " + x + ", " + y);
} }
else else