mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 13:55:35 +08:00
* This commit incorporates the heart of the OpenGridProtocol patch that is currently on Forge in a nice, friendly modular format.
* There are a lot of changes and this is quite experimental. It's off by default, but you can turn it on by examining the bottom of the opensim.ini.example for the proper OpenSim.ini settings. Remember, you still need an agent domain.. * Furthermore, it isn't quite right when it comes to teleporting to remote regions (place_avatar)
This commit is contained in:
42
OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs
Normal file
42
OpenSim/Region/ClientStack/LindenUDP/KillPacket.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife.Packets;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
class KillPacket : Packet
|
||||
{
|
||||
private Header header;
|
||||
public override void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override Header Header { get { return header; } set { header = value; }}
|
||||
|
||||
public override byte[] ToBytes()
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
public KillPacket()
|
||||
{
|
||||
Header = new LowHeader();
|
||||
Header.ID = 65531;
|
||||
Header.Reliable = true;
|
||||
}
|
||||
|
||||
public override PacketType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return PacketType.UseCircuitCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
private Dictionary<string, LLUUID> m_defaultAnimations = new Dictionary<string, LLUUID>();
|
||||
|
||||
private bool m_SendLogoutPacketWhenClosing = true;
|
||||
|
||||
/* protected variables */
|
||||
|
||||
protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
|
||||
@@ -368,6 +370,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
set { m_IsActive = value; }
|
||||
}
|
||||
|
||||
public bool SendLogoutPacketWhenClosing
|
||||
{
|
||||
set { m_SendLogoutPacketWhenClosing = value; }
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
|
||||
@@ -451,7 +458,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!(shutdownCircuit))
|
||||
{
|
||||
GC.Collect();
|
||||
m_clientThread.Abort();
|
||||
|
||||
// Sends a KillPacket object, with which, the
|
||||
// blockingqueue dequeues and sees it's a killpacket
|
||||
// and terminates within the context of the client thread.
|
||||
// This ensures that it's done from within the context
|
||||
// of the client thread regardless of where Close() is called.
|
||||
KillEndDone();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -752,7 +765,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
ClientLoop();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (System.Exception e)
|
||||
{
|
||||
if (e is ThreadAbortException)
|
||||
throw e;
|
||||
@@ -3740,6 +3753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_PacketHandler.InPacket((Packet) NewPack);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The dreaded OutPacket. This should only be called from within
|
||||
/// the ClientStack itself right now
|
||||
@@ -6093,15 +6107,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public void SendLogoutPacket()
|
||||
{
|
||||
LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
logReply.AgentData.AgentID = AgentId;
|
||||
logReply.AgentData.SessionID = SessionId;
|
||||
logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
|
||||
logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
|
||||
logReply.InventoryData[0].ItemID = LLUUID.Zero;
|
||||
// I know this is a bit of a hack, however there are times when you don't
|
||||
// want to send this, but still need to do the rest of the shutdown process
|
||||
// this method gets called from the packet server.. which makes it practically
|
||||
// impossible to do any other way.
|
||||
|
||||
OutPacket(logReply, ThrottleOutPacketType.Task);
|
||||
if (m_SendLogoutPacketWhenClosing)
|
||||
{
|
||||
LogoutReplyPacket logReply = (LogoutReplyPacket)PacketPool.Instance.GetPacket(PacketType.LogoutReply);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
logReply.AgentData.AgentID = AgentId;
|
||||
logReply.AgentData.SessionID = SessionId;
|
||||
logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
|
||||
logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
|
||||
logReply.InventoryData[0].ItemID = LLUUID.Zero;
|
||||
|
||||
OutPacket(logReply, ThrottleOutPacketType.Task);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendHealth(float health)
|
||||
@@ -6443,5 +6465,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
OutPacket(reply, ThrottleOutPacketType.Land);
|
||||
}
|
||||
|
||||
public void KillEndDone()
|
||||
{
|
||||
KillPacket kp = new KillPacket();
|
||||
OutPacket(kp, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using System.Reflection;
|
||||
using libsecondlife;
|
||||
@@ -233,6 +234,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// to. Packet drop notifies will not be triggered in this
|
||||
// configuration!
|
||||
//
|
||||
|
||||
if ((m_SynchronizeClient != null) && (!m_Client.IsActive))
|
||||
{
|
||||
if (m_SynchronizeClient(m_Client.Scene, packet,
|
||||
@@ -744,6 +746,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
// If we sent a killpacket
|
||||
if (packet is KillPacket)
|
||||
Thread.CurrentThread.Abort();
|
||||
|
||||
// Actually make the byte array and send it
|
||||
byte[] sendbuffer = packet.ToBytes();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user