* Commit 2/3 - Please dont attempt to update to this revision until all 3 are in.

0.6.0-stable
Adam Frisby 2008-05-02 16:41:08 +00:00
parent c6236b5cf3
commit 29b8c84cea
14 changed files with 6339 additions and 6367 deletions

View File

@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
@ -70,7 +71,7 @@ namespace OpenSim
protected string m_storageDll; protected string m_storageDll;
protected List<UDPServer> m_udpServers = new List<UDPServer>(); protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
protected List<RegionInfo> m_regionData = new List<RegionInfo>(); protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected bool m_physicalPrim; protected bool m_physicalPrim;
@ -105,9 +106,9 @@ namespace OpenSim
get { return m_httpServer; } get { return m_httpServer; }
} }
public List<UDPServer> UdpServers public List<IClientNetworkServer> UdpServers
{ {
get { return m_udpServers; } get { return m_clientServers; }
} }
public List<RegionInfo> RegionData public List<RegionInfo> RegionData
@ -327,7 +328,7 @@ namespace OpenSim
// We are done with startup // We are done with startup
m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}",
m_udpServers.Count.ToString(), m_udpServers.Count > 1 ? "s" : ""); m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : "");
WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.WaitOne();
m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye."); m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye.");
Environment.Exit(0); Environment.Exit(0);
@ -452,7 +453,7 @@ namespace OpenSim
/// <param name="regionInfo"></param> /// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
{ {
return CreateRegion(regionInfo, portadd_flag, false); return CreateRegion(regionInfo, portadd_flag, false);
} }
@ -463,7 +464,7 @@ namespace OpenSim
/// <param name="regionInfo"></param> /// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo) public LLUDPServer CreateRegion(RegionInfo regionInfo)
{ {
return CreateRegion(regionInfo, false, true); return CreateRegion(regionInfo, false, true);
} }
@ -475,7 +476,7 @@ namespace OpenSim
/// <param name="portadd_flag"></param> /// <param name="portadd_flag"></param>
/// <param name="do_post_init"></param> /// <param name="do_post_init"></param>
/// <returns></returns> /// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init) public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init)
{ {
int port = regionInfo.InternalEndPoint.Port; int port = regionInfo.InternalEndPoint.Port;
@ -495,7 +496,7 @@ namespace OpenSim
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
} }
UDPServer udpServer; LLUDPServer udpServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions); Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
m_log.Info("[MODULES]: Loading Region's modules"); m_log.Info("[MODULES]: Loading Region's modules");
@ -548,7 +549,7 @@ namespace OpenSim
m_sceneManager.Add(scene); m_sceneManager.Add(scene);
m_udpServers.Add(udpServer); m_clientServers.Add(udpServer);
m_regionData.Add(regionInfo); m_regionData.Add(regionInfo);
udpServer.ServerListener(); udpServer.ServerListener();
@ -586,9 +587,9 @@ namespace OpenSim
bool foundUDPServer = false; bool foundUDPServer = false;
int UDPServerElement = 0; int UDPServerElement = 0;
for (int i = 0; i < m_udpServers.Count; i++) for (int i = 0; i < m_clientServers.Count; i++)
{ {
if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) if (m_clientServers[i].HandlesRegion(new Location(whichRegion.RegionHandle)))
{ {
UDPServerElement = i; UDPServerElement = i;
foundUDPServer = true; foundUDPServer = true;
@ -598,8 +599,8 @@ namespace OpenSim
if (foundUDPServer) if (foundUDPServer)
{ {
// m_udpServers[UDPServerElement].Server.End // m_udpServers[UDPServerElement].Server.End
m_udpServers[UDPServerElement].Server.Close(); m_clientServers[UDPServerElement].Server.Close();
m_udpServers.RemoveAt(UDPServerElement); m_clientServers.RemoveAt(UDPServerElement);
} }
//Removing the region from the sim's database of regions.. //Removing the region from the sim's database of regions..

View File

@ -32,14 +32,13 @@ using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Threading; using System.Threading;
using System.Timers;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
@ -111,8 +110,8 @@ namespace OpenSim
{ {
m_scriptTimer = new Timer(); m_scriptTimer = new Timer();
m_scriptTimer.Enabled = true; m_scriptTimer.Enabled = true;
m_scriptTimer.Interval = (int)(1200 * 1000); m_scriptTimer.Interval = 1200 * 1000;
m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript); m_scriptTimer.Elapsed += RunAutoTimerScript;
} }
PrintFileToConsole("startuplogo.txt"); PrintFileToConsole("startuplogo.txt");
} }
@ -156,7 +155,7 @@ namespace OpenSim
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
StreamReader readFile = File.OpenText(fileName); StreamReader readFile = File.OpenText(fileName);
string currentCommand = String.Empty; string currentCommand;
while ((currentCommand = readFile.ReadLine()) != null) while ((currentCommand = readFile.ReadLine()) != null)
{ {
if (currentCommand != String.Empty) if (currentCommand != String.Empty)
@ -177,7 +176,7 @@ namespace OpenSim
if (File.Exists(fileName)) if (File.Exists(fileName))
{ {
StreamReader readFile = File.OpenText(fileName); StreamReader readFile = File.OpenText(fileName);
string currentLine = String.Empty; string currentLine;
while ((currentLine = readFile.ReadLine()) != null) while ((currentLine = readFile.ReadLine()) != null)
{ {
m_log.Info("[!]" + currentLine); m_log.Info("[!]" + currentLine);
@ -609,55 +608,6 @@ namespace OpenSim
m_assetCache.ShowState(); m_assetCache.ShowState();
break; break;
case "users":
IList agents = m_sceneManager.GetCurrentSceneAvatars();
m_console.Notice(String.Format("\nAgents connected: {0}\n", agents.Count));
m_console.Notice(
String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}", "Firstname", "Lastname",
"Agent ID", "Circuit", "IP", "Region", "Status"));
foreach (ScenePresence presence in agents)
{
RegionInfo regionInfo = m_sceneManager.GetRegionInfo(presence.RegionHandle);
string regionName;
EndPoint ep = null;
if (regionInfo == null)
{
regionName = "Unresolvable";
}
else
{
regionName = regionInfo.RegionName;
}
for (int i = 0; i < m_udpServers.Count; i++)
{
if (m_udpServers[i].RegionHandle == presence.RegionHandle)
{
m_udpServers[i].clientCircuits_reverse.TryGetValue(presence.ControllingClient.CircuitCode, out ep);
}
}
m_console.Notice(
String.Format(
"{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}{6,-15}",
presence.Firstname,
presence.Lastname,
presence.UUID,
presence.ControllingClient.CircuitCode,
ep,
regionName,
((((ClientView)presence.ControllingClient).PacketProcessingEnabled)
?"Active client":"Standby client")));
}
m_console.Notice("");
break;
case "modules": case "modules":
m_console.Notice("The currently loaded shared modules are:"); m_console.Notice("The currently loaded shared modules are:");
foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules)

View File

@ -0,0 +1,11 @@
using System.Net.Sockets;
using OpenSim.Framework;
namespace OpenSim.Region.ClientStack
{
public interface IClientNetworkServer
{
Socket Server { get; }
bool HandlesRegion(Location x);
}
}

View File

@ -27,12 +27,12 @@
using System.Net.Sockets; using System.Net.Sockets;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public interface ClientStackNetworkHandler public interface LLClientStackNetworkHandler
{ {
void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender); void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode); // EndPoint packetSender);
void RemoveClientCircuit(uint circuitcode); void RemoveClientCircuit(uint circuitcode);
void RegisterPacketServer(PacketServer server); void RegisterPacketServer(LLPacketServer server);
} }
} }

View File

@ -39,10 +39,11 @@ using libsecondlife.Packets;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public delegate bool PacketMethod(IClientAPI simClient, Packet packet); public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
@ -50,7 +51,7 @@ namespace OpenSim.Region.ClientStack
/// Handles new client connections /// Handles new client connections
/// Constructor takes a single Packet and authenticates everything /// Constructor takes a single Packet and authenticates everything
/// </summary> /// </summary>
public class ClientView : IClientAPI public class LLClientView : IClientAPI
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -105,7 +106,7 @@ namespace OpenSim.Region.ClientStack
protected IScene m_scene; protected IScene m_scene;
protected AgentCircuitManager m_authenticateSessionsHandler; protected AgentCircuitManager m_authenticateSessionsHandler;
protected PacketQueue m_packetQueue; protected LLPacketQueue m_packetQueue;
protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>(); protected Dictionary<uint, uint> m_pendingAcks = new Dictionary<uint, uint>();
protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>(); protected Dictionary<uint, Packet> m_needAck = new Dictionary<uint, Packet>();
@ -116,7 +117,7 @@ namespace OpenSim.Region.ClientStack
protected const int MAX_APPENDED_ACKS = 10; protected const int MAX_APPENDED_ACKS = 10;
protected const int RESEND_TIMEOUT = 4000; protected const int RESEND_TIMEOUT = 4000;
protected const int MAX_SEQUENCE = 0xFFFFFF; protected const int MAX_SEQUENCE = 0xFFFFFF;
protected PacketServer m_networkServer; protected LLPacketServer m_networkServer;
/* public variables */ /* public variables */
protected string m_firstName; protected string m_firstName;
@ -317,7 +318,7 @@ namespace OpenSim.Region.ClientStack
/* METHODS */ /* METHODS */
public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer, public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
{ {
m_moneyBalance = 1000; m_moneyBalance = 1000;
@ -347,7 +348,7 @@ namespace OpenSim.Region.ClientStack
// in it to process. It's an on-purpose threadlock though because // in it to process. It's an on-purpose threadlock though because
// without it, the clientloop will suck up all sim resources. // without it, the clientloop will suck up all sim resources.
m_packetQueue = new PacketQueue(agentId); m_packetQueue = new LLPacketQueue(agentId);
RegisterLocalPacketHandlers(); RegisterLocalPacketHandlers();
@ -569,7 +570,7 @@ namespace OpenSim.Region.ClientStack
m_log.Info("[CLIENT]: Entered loop"); m_log.Info("[CLIENT]: Entered loop");
while (true) while (true)
{ {
QueItem nextPacket = m_packetQueue.Dequeue(); LLQueItem nextPacket = m_packetQueue.Dequeue();
if (nextPacket == null) if (nextPacket == null)
{ {
break; break;
@ -966,7 +967,7 @@ namespace OpenSim.Region.ClientStack
patches[2] = x + 2 + y * 16; patches[2] = x + 2 + y * 16;
patches[3] = x + 3 + y * 16; patches[3] = x + 3 + y * 16;
Packet layerpack = TerrainManager.CreateLandPacket(map, patches); Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
OutPacket(layerpack, ThrottleOutPacketType.Land); OutPacket(layerpack, ThrottleOutPacketType.Land);
} }
} }
@ -974,7 +975,7 @@ namespace OpenSim.Region.ClientStack
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[client]: " + m_log.Warn("[client]: " +
"ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
} }
} }
@ -995,13 +996,13 @@ namespace OpenSim.Region.ClientStack
patches[0] = patchx + 0 + patchy * 16; patches[0] = patchx + 0 + patchy * 16;
Packet layerpack = TerrainManager.CreateLandPacket(map, patches); Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
OutPacket(layerpack, ThrottleOutPacketType.Land); OutPacket(layerpack, ThrottleOutPacketType.Land);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[client]: " + m_log.Warn("[client]: " +
"ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString()); "ClientView.API.cs: SendLayerData() - Failed with exception " + e.ToString());
} }
} }
@ -1184,7 +1185,7 @@ namespace OpenSim.Region.ClientStack
payPrice[2] == 0 && payPrice[2] == 0 &&
payPrice[3] == 0 && payPrice[3] == 0 &&
payPrice[4] == 0) payPrice[4] == 0)
return; return;
PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply); PayPriceReplyPacket payPriceReply = (PayPriceReplyPacket)PacketPool.Instance.GetPacket(PacketType.PayPriceReply);
payPriceReply.ObjectData.ObjectID = objectID; payPriceReply.ObjectData.ObjectID = objectID;
@ -1527,7 +1528,7 @@ namespace OpenSim.Region.ClientStack
UpdateCreateInventoryItemPacket InventoryReply UpdateCreateInventoryItemPacket InventoryReply
= (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket( = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(
PacketType.UpdateCreateInventoryItem); PacketType.UpdateCreateInventoryItem);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
InventoryReply.AgentData.AgentID = AgentId; InventoryReply.AgentData.AgentID = AgentId;
@ -1600,9 +1601,9 @@ namespace OpenSim.Region.ClientStack
} }
public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent) int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
{ {
EconomyDataPacket economyData = (EconomyDataPacket)PacketPool.Instance.GetPacket(PacketType.EconomyData); EconomyDataPacket economyData = (EconomyDataPacket)PacketPool.Instance.GetPacket(PacketType.EconomyData);
economyData.Info.EnergyEfficiency = EnergyEfficiency; economyData.Info.EnergyEfficiency = EnergyEfficiency;
@ -2037,7 +2038,7 @@ namespace OpenSim.Region.ClientStack
SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags, SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags,
objectID, ownerID, text, color, parentID, particleSystem, objectID, ownerID, text, color, parentID, particleSystem,
rotation, clickAction, textureanim, false,(uint)0, LLUUID.Zero); rotation, clickAction, textureanim, false,(uint)0, LLUUID.Zero);
} }
public void SendPrimitiveToClient( public void SendPrimitiveToClient(
ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos,
@ -2082,7 +2083,7 @@ namespace OpenSim.Region.ClientStack
// Item from inventory??? // Item from inventory???
outPacket.ObjectData[0].NameValue = outPacket.ObjectData[0].NameValue =
Helpers.StringToField("AttachItemID STRING RW SV " + AssetId.UUID); Helpers.StringToField("AttachItemID STRING RW SV " + AssetId.UUID);
outPacket.ObjectData[0].State = (byte)((AttachPoint % 16) * 16 + (AttachPoint / 16)); outPacket.ObjectData[0].State = (byte)((AttachPoint % 16) * 16 + (AttachPoint / 16));
} }
@ -2506,8 +2507,8 @@ namespace OpenSim.Region.ClientStack
if (handlerMoneyTransferRequest != null) if (handlerMoneyTransferRequest != null)
{ {
handlerMoneyTransferRequest(money.MoneyData.SourceID, money.MoneyData.DestID, handlerMoneyTransferRequest(money.MoneyData.SourceID, money.MoneyData.DestID,
money.MoneyData.Amount, money.MoneyData.TransactionType, money.MoneyData.Amount, money.MoneyData.TransactionType,
Util.FieldToString(money.MoneyData.Description)); Util.FieldToString(money.MoneyData.Description));
} }
return true; return true;
@ -2527,8 +2528,8 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelBuy != null) if (handlerParcelBuy != null)
{ {
handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final, parcel.Data.IsGroupOwned, handlerParcelBuy(parcel.AgentData.AgentID, parcel.Data.GroupID, parcel.Data.Final, parcel.Data.IsGroupOwned,
parcel.Data.RemoveContribution, parcel.Data.LocalID, parcel.ParcelData.Area, parcel.ParcelData.Price, parcel.Data.RemoveContribution, parcel.Data.LocalID, parcel.ParcelData.Area, parcel.ParcelData.Price,
false); false);
} }
return true; return true;
@ -2972,8 +2973,8 @@ namespace OpenSim.Region.ClientStack
catch (Exception e) catch (Exception e)
{ {
m_log.Warn("[client]: " + m_log.Warn("[client]: " +
"ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + "ClientView.m_packetQueue.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " +
m_userEndPoint.ToString() + " - killing thread"); m_userEndPoint.ToString() + " - killing thread");
m_log.Error(e.ToString()); m_log.Error(e.ToString());
Close(true); Close(true);
} }
@ -3036,7 +3037,7 @@ namespace OpenSim.Region.ClientStack
} }
else else
{ {
QueItem item = new QueItem(); LLQueItem item = new LLQueItem();
item.Packet = NewPack; item.Packet = NewPack;
item.Incoming = true; item.Incoming = true;
m_packetQueue.Enqueue(item); m_packetQueue.Enqueue(item);
@ -3046,16 +3047,16 @@ namespace OpenSim.Region.ClientStack
public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType) public virtual void OutPacket(Packet NewPack, ThrottleOutPacketType throttlePacketType)
{ {
if ((SynchronizeClient != null) && (!PacketProcessingEnabled)) if ((SynchronizeClient != null) && (!IsActive))
{ {
// Sending packet to active client's server. // Sending packet to active client's server.
if (SynchronizeClient(m_scene, NewPack, m_agentId, throttlePacketType)) if (SynchronizeClient(m_scene, NewPack, m_agentId, throttlePacketType))
{ {
return; return;
} }
} }
QueItem item = new QueItem(); LLQueItem item = new LLQueItem();
item.Packet = NewPack; item.Packet = NewPack;
item.Incoming = false; item.Incoming = false;
item.throttleType = throttlePacketType; // Packet throttle type item.throttleType = throttlePacketType; // Packet throttle type
@ -3184,7 +3185,7 @@ namespace OpenSim.Region.ClientStack
private bool m_packetProcessingEnabled = true; private bool m_packetProcessingEnabled = true;
public bool PacketProcessingEnabled { public bool IsActive {
get { return m_packetProcessingEnabled; } get { return m_packetProcessingEnabled; }
set { m_packetProcessingEnabled = value; } set { m_packetProcessingEnabled = value; }
} }
@ -3202,7 +3203,7 @@ namespace OpenSim.Region.ClientStack
{ {
switch (Pack.Type) switch (Pack.Type)
{ {
#region Scene/Avatar #region Scene/Avatar
case PacketType.AvatarPropertiesRequest: case PacketType.AvatarPropertiesRequest:
AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack;
@ -3242,23 +3243,23 @@ namespace OpenSim.Region.ClientStack
handlerChatFromViewer(this, args); handlerChatFromViewer(this, args);
} }
break; break;
case PacketType.AvatarPropertiesUpdate: case PacketType.AvatarPropertiesUpdate:
AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack; AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack;
handlerUpdateAvatarProperties = OnUpdateAvatarProperties; handlerUpdateAvatarProperties = OnUpdateAvatarProperties;
if (handlerUpdateAvatarProperties != null) if (handlerUpdateAvatarProperties != null)
{ {
AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData; AvatarPropertiesUpdatePacket.PropertiesDataBlock Properties = Packet.PropertiesData;
UserProfileData UserProfile = new UserProfileData(); UserProfileData UserProfile = new UserProfileData();
UserProfile.ID = AgentId; UserProfile.ID = AgentId;
UserProfile.AboutText = Helpers.FieldToUTF8String(Properties.AboutText); UserProfile.AboutText = Helpers.FieldToUTF8String(Properties.AboutText);
UserProfile.FirstLifeAboutText = Helpers.FieldToUTF8String(Properties.FLAboutText); UserProfile.FirstLifeAboutText = Helpers.FieldToUTF8String(Properties.FLAboutText);
UserProfile.FirstLifeImage = Properties.FLImageID; UserProfile.FirstLifeImage = Properties.FLImageID;
UserProfile.Image = Properties.ImageID; UserProfile.Image = Properties.ImageID;
handlerUpdateAvatarProperties(this, UserProfile); handlerUpdateAvatarProperties(this, UserProfile);
} }
break; break;
case PacketType.ScriptDialogReply: case PacketType.ScriptDialogReply:
ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
@ -3289,12 +3290,12 @@ namespace OpenSim.Region.ClientStack
if (handlerInstantMessage != null) if (handlerInstantMessage != null)
{ {
handlerInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID, handlerInstantMessage(this, msgpack.AgentData.AgentID, msgpack.AgentData.SessionID,
msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.ID,
msgpack.MessageBlock.Timestamp, IMfromName, IMmessage, msgpack.MessageBlock.Timestamp, IMfromName, IMmessage,
msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup, msgpack.MessageBlock.Dialog, msgpack.MessageBlock.FromGroup,
msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID, msgpack.MessageBlock.Offline, msgpack.MessageBlock.ParentEstateID,
msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID, msgpack.MessageBlock.Position, msgpack.MessageBlock.RegionID,
msgpack.MessageBlock.BinaryBucket); msgpack.MessageBlock.BinaryBucket);
} }
break; break;
@ -3346,12 +3347,12 @@ namespace OpenSim.Region.ClientStack
//m_log.Info("[REZData]: " + rezPacket.ToString()); //m_log.Info("[REZData]: " + rezPacket.ToString());
handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd, handlerRezObject(this, rezPacket.InventoryData.ItemID, rezPacket.RezData.RayEnd,
rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID, rezPacket.RezData.RayStart, rezPacket.RezData.RayTargetID,
rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection, rezPacket.RezData.BypassRaycast, rezPacket.RezData.RayEndIsIntersection,
rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask, rezPacket.RezData.EveryoneMask, rezPacket.RezData.GroupMask,
rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags, rezPacket.RezData.NextOwnerMask, rezPacket.RezData.ItemFlags,
rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem, rezPacket.RezData.RezSelected, rezPacket.RezData.RemoveItem,
rezPacket.RezData.FromTaskID); rezPacket.RezData.FromTaskID);
} }
break; break;
case PacketType.DeRezObject: case PacketType.DeRezObject:
@ -3374,10 +3375,10 @@ namespace OpenSim.Region.ClientStack
if (handlerModifyTerrain != null) if (handlerModifyTerrain != null)
{ {
handlerModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, handlerModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
modify.ModifyBlock.BrushSize, modify.ModifyBlock.BrushSize,
modify.ModifyBlock.Action, modify.ParcelData[i].North, modify.ModifyBlock.Action, modify.ParcelData[i].North,
modify.ParcelData[i].West, modify.ParcelData[i].South, modify.ParcelData[i].West, modify.ParcelData[i].South,
modify.ParcelData[i].East, this); modify.ParcelData[i].East, this);
} }
} }
} }
@ -3457,7 +3458,7 @@ namespace OpenSim.Region.ClientStack
{ {
RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack; RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket)Pack;
handlerRezSingleAttachment(this, rez.ObjectData.ItemID, handlerRezSingleAttachment(this, rez.ObjectData.ItemID,
rez.ObjectData.AttachmentPt, rez.ObjectData.ItemFlags, rez.ObjectData.NextOwnerMask); rez.ObjectData.AttachmentPt, rez.ObjectData.ItemFlags, rez.ObjectData.NextOwnerMask);
} }
break; break;
@ -3594,7 +3595,7 @@ namespace OpenSim.Region.ClientStack
if (handlerAvatarPickerRequest != null) if (handlerAvatarPickerRequest != null)
{ {
handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID, handlerAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
Helpers.FieldToUTF8String(querydata.Name)); Helpers.FieldToUTF8String(querydata.Name));
} }
break; break;
case PacketType.AgentDataUpdateRequest: case PacketType.AgentDataUpdateRequest:
@ -3627,8 +3628,8 @@ namespace OpenSim.Region.ClientStack
if (handlerSetStartLocationRequest != null) if (handlerSetStartLocationRequest != null)
{ {
handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos, handlerSetStartLocationRequest(this, 0, avSetStartLocationRequestPacket.StartLocationData.LocationPos,
avSetStartLocationRequestPacket.StartLocationData.LocationLookAt, avSetStartLocationRequestPacket.StartLocationData.LocationLookAt,
avSetStartLocationRequestPacket.StartLocationData.LocationID); avSetStartLocationRequestPacket.StartLocationData.LocationID);
} }
} }
break; break;
@ -3650,9 +3651,9 @@ namespace OpenSim.Region.ClientStack
break; break;
#endregion #endregion
#region Objects/m_sceneObjects #region Objects/m_sceneObjects
case PacketType.ObjectLink: case PacketType.ObjectLink:
ObjectLinkPacket link = (ObjectLinkPacket)Pack; ObjectLinkPacket link = (ObjectLinkPacket)Pack;
@ -3717,7 +3718,7 @@ namespace OpenSim.Region.ClientStack
if (handlerUpdatePrimShape != null) if (handlerUpdatePrimShape != null)
{ {
handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID, handlerUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
shapePacket.ObjectData[i]); shapePacket.ObjectData[i]);
} }
} }
break; break;
@ -3728,8 +3729,8 @@ namespace OpenSim.Region.ClientStack
if (handlerUpdateExtraParams != null) if (handlerUpdateExtraParams != null)
{ {
handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID, handlerUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID,
extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamType,
extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData);
} }
break; break;
case PacketType.ObjectDuplicate: case PacketType.ObjectDuplicate:
@ -3744,8 +3745,8 @@ namespace OpenSim.Region.ClientStack
if (handlerObjectDuplicate != null) if (handlerObjectDuplicate != null)
{ {
handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
AgentandGroupData.GroupID); AgentandGroupData.GroupID);
} }
} }
@ -3799,7 +3800,7 @@ namespace OpenSim.Region.ClientStack
if (handlerUpdatePrimTexture != null) if (handlerUpdatePrimTexture != null)
{ {
handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID, handlerUpdatePrimTexture(imagePack.ObjectData[i].ObjectLocalID,
imagePack.ObjectData[i].TextureEntry, this); imagePack.ObjectData[i].TextureEntry, this);
} }
} }
break; break;
@ -3821,7 +3822,7 @@ namespace OpenSim.Region.ClientStack
if (handlerGrabUpdate != null) if (handlerGrabUpdate != null)
{ {
handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial, handlerGrabUpdate(grabUpdate.ObjectData.ObjectID, grabUpdate.ObjectData.GrabOffsetInitial,
grabUpdate.ObjectData.GrabPosition, this); grabUpdate.ObjectData.GrabPosition, this);
} }
break; break;
case PacketType.ObjectDeGrab: case PacketType.ObjectDeGrab:
@ -3844,7 +3845,7 @@ namespace OpenSim.Region.ClientStack
if (handlerObjectDescription != null) if (handlerObjectDescription != null)
{ {
handlerObjectDescription(this, objDes.ObjectData[i].LocalID, handlerObjectDescription(this, objDes.ObjectData[i].LocalID,
Util.FieldToString(objDes.ObjectData[i].Description)); Util.FieldToString(objDes.ObjectData[i].Description));
} }
} }
break; break;
@ -3858,7 +3859,7 @@ namespace OpenSim.Region.ClientStack
if (handlerObjectName != null) if (handlerObjectName != null)
{ {
handlerObjectName(this, objName.ObjectData[i].LocalID, handlerObjectName(this, objName.ObjectData[i].LocalID,
Util.FieldToString(objName.ObjectData[i].Name)); Util.FieldToString(objName.ObjectData[i].Name));
} }
} }
break; break;
@ -3930,9 +3931,9 @@ namespace OpenSim.Region.ClientStack
if (handlerObjectDuplicateOnRay != null) if (handlerObjectDuplicateOnRay != null)
{ {
handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, dupeOnRay.AgentData.AgentID, dupeOnRay.AgentData.GroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
} }
} }
@ -3948,7 +3949,7 @@ namespace OpenSim.Region.ClientStack
if (handlerRequestObjectPropertiesFamily != null) if (handlerRequestObjectPropertiesFamily != null)
{ {
handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags, handlerRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags,
packObjBlock.ObjectID); packObjBlock.ObjectID);
} }
break; break;
@ -3979,9 +3980,9 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#endregion #endregion
#region Inventory/Asset/Other related packets #region Inventory/Asset/Other related packets
case PacketType.RequestImage: case PacketType.RequestImage:
RequestImagePacket imageRequest = (RequestImagePacket)Pack; RequestImagePacket imageRequest = (RequestImagePacket)Pack;
@ -4027,9 +4028,9 @@ namespace OpenSim.Region.ClientStack
if (handlerAssetUploadRequest != null) if (handlerAssetUploadRequest != null)
{ {
handlerAssetUploadRequest(this, temp, handlerAssetUploadRequest(this, temp,
request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.TransactionID, request.AssetBlock.Type,
request.AssetBlock.AssetData, request.AssetBlock.StoreLocal, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal,
request.AssetBlock.Tempfile); request.AssetBlock.Tempfile);
} }
break; break;
case PacketType.RequestXfer: case PacketType.RequestXfer:
@ -4067,9 +4068,9 @@ namespace OpenSim.Region.ClientStack
if (handlerCreateInventoryFolder != null) if (handlerCreateInventoryFolder != null)
{ {
handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID, handlerCreateInventoryFolder(this, invFolder.FolderData.FolderID,
(ushort)invFolder.FolderData.Type, (ushort)invFolder.FolderData.Type,
Util.FieldToString(invFolder.FolderData.Name), Util.FieldToString(invFolder.FolderData.Name),
invFolder.FolderData.ParentID); invFolder.FolderData.ParentID);
} }
break; break;
case PacketType.UpdateInventoryFolder: case PacketType.UpdateInventoryFolder:
@ -4117,14 +4118,14 @@ namespace OpenSim.Region.ClientStack
if (handlerCreateNewInventoryItem != null) if (handlerCreateNewInventoryItem != null)
{ {
handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID, handlerCreateNewInventoryItem(this, createItem.InventoryBlock.TransactionID,
createItem.InventoryBlock.FolderID, createItem.InventoryBlock.FolderID,
createItem.InventoryBlock.CallbackID, createItem.InventoryBlock.CallbackID,
Util.FieldToString(createItem.InventoryBlock.Description), Util.FieldToString(createItem.InventoryBlock.Description),
Util.FieldToString(createItem.InventoryBlock.Name), Util.FieldToString(createItem.InventoryBlock.Name),
createItem.InventoryBlock.InvType, createItem.InventoryBlock.InvType,
createItem.InventoryBlock.Type, createItem.InventoryBlock.Type,
createItem.InventoryBlock.WearableType, createItem.InventoryBlock.WearableType,
createItem.InventoryBlock.NextOwnerMask); createItem.InventoryBlock.NextOwnerMask);
} }
break; break;
case PacketType.FetchInventory: case PacketType.FetchInventory:
@ -4153,8 +4154,8 @@ namespace OpenSim.Region.ClientStack
if (handlerFetchInventoryDescendents != null) if (handlerFetchInventoryDescendents != null)
{ {
handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID, handlerFetchInventoryDescendents(this, Fetch.InventoryData.FolderID, Fetch.InventoryData.OwnerID,
Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems, Fetch.InventoryData.FetchFolders, Fetch.InventoryData.FetchItems,
Fetch.InventoryData.SortOrder); Fetch.InventoryData.SortOrder);
} }
break; break;
case PacketType.PurgeInventoryDescendents: case PacketType.PurgeInventoryDescendents:
@ -4247,8 +4248,8 @@ namespace OpenSim.Region.ClientStack
if (handlerCopyInventoryItem != null) if (handlerCopyInventoryItem != null)
{ {
handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID, handlerCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
datablock.OldItemID, datablock.NewFolderID, datablock.OldItemID, datablock.NewFolderID,
Util.FieldToString(datablock.NewName)); Util.FieldToString(datablock.NewName));
} }
} }
} }
@ -4264,7 +4265,7 @@ namespace OpenSim.Region.ClientStack
if (handlerMoveInventoryItem != null) if (handlerMoveInventoryItem != null)
{ {
handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length,
Util.FieldToString(datablock.NewName)); Util.FieldToString(datablock.NewName));
} }
} }
} }
@ -4319,7 +4320,7 @@ namespace OpenSim.Region.ClientStack
if (handlerUpdateTaskInventory != null) if (handlerUpdateTaskInventory != null)
{ {
handlerUpdateTaskInventory(this, updatetask.InventoryData.ItemID, handlerUpdateTaskInventory(this, updatetask.InventoryData.ItemID,
updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID); updatetask.InventoryData.FolderID, updatetask.UpdateData.LocalID);
} }
} }
} }
@ -4378,7 +4379,7 @@ namespace OpenSim.Region.ClientStack
if (handlerRequestMapBlocks != null) if (handlerRequestMapBlocks != null)
{ {
handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY, handlerRequestMapBlocks(this, MapRequest.PositionData.MinX, MapRequest.PositionData.MinY,
MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY); MapRequest.PositionData.MaxX, MapRequest.PositionData.MaxY);
} }
break; break;
case PacketType.MapNameRequest: case PacketType.MapNameRequest:
@ -4461,7 +4462,7 @@ namespace OpenSim.Region.ClientStack
if (handlerTeleportLocationRequest != null) if (handlerTeleportLocationRequest != null)
{ {
handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position,
tpLocReq.Info.LookAt, 16); tpLocReq.Info.LookAt, 16);
} }
else else
{ {
@ -4473,7 +4474,7 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#endregion #endregion
case PacketType.UUIDNameRequest: case PacketType.UUIDNameRequest:
@ -4488,7 +4489,7 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#region Parcel related packets #region Parcel related packets
case PacketType.ParcelAccessListRequest: case PacketType.ParcelAccessListRequest:
ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack; ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
@ -4498,8 +4499,8 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelAccessListRequest != null) if (handlerParcelAccessListRequest != null)
{ {
handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, handlerParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
requestPacket.Data.Flags, requestPacket.Data.SequenceID, requestPacket.Data.Flags, requestPacket.Data.SequenceID,
requestPacket.Data.LocalID, this); requestPacket.Data.LocalID, this);
} }
break; break;
@ -4519,8 +4520,8 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelAccessListUpdateRequest != null) if (handlerParcelAccessListUpdateRequest != null)
{ {
handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
updatePacket.AgentData.SessionID, updatePacket.Data.Flags, updatePacket.AgentData.SessionID, updatePacket.Data.Flags,
updatePacket.Data.LocalID, entries, this); updatePacket.Data.LocalID, entries, this);
} }
break; break;
case PacketType.ParcelPropertiesRequest: case PacketType.ParcelPropertiesRequest:
@ -4531,11 +4532,11 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelPropertiesRequest != null) if (handlerParcelPropertiesRequest != null)
{ {
handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West), handlerParcelPropertiesRequest((int)Math.Round(propertiesRequest.ParcelData.West),
(int)Math.Round(propertiesRequest.ParcelData.South), (int)Math.Round(propertiesRequest.ParcelData.South),
(int)Math.Round(propertiesRequest.ParcelData.East), (int)Math.Round(propertiesRequest.ParcelData.East),
(int)Math.Round(propertiesRequest.ParcelData.North), (int)Math.Round(propertiesRequest.ParcelData.North),
propertiesRequest.ParcelData.SequenceID, propertiesRequest.ParcelData.SequenceID,
propertiesRequest.ParcelData.SnapSelection, this); propertiesRequest.ParcelData.SnapSelection, this);
} }
break; break;
case PacketType.ParcelDivide: case PacketType.ParcelDivide:
@ -4545,9 +4546,9 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelDivideRequest != null) if (handlerParcelDivideRequest != null)
{ {
handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West), handlerParcelDivideRequest((int)Math.Round(landDivide.ParcelData.West),
(int)Math.Round(landDivide.ParcelData.South), (int)Math.Round(landDivide.ParcelData.South),
(int)Math.Round(landDivide.ParcelData.East), (int)Math.Round(landDivide.ParcelData.East),
(int)Math.Round(landDivide.ParcelData.North), this); (int)Math.Round(landDivide.ParcelData.North), this);
} }
break; break;
case PacketType.ParcelJoin: case PacketType.ParcelJoin:
@ -4558,9 +4559,9 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelJoinRequest != null) if (handlerParcelJoinRequest != null)
{ {
handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West), handlerParcelJoinRequest((int)Math.Round(landJoin.ParcelData.West),
(int)Math.Round(landJoin.ParcelData.South), (int)Math.Round(landJoin.ParcelData.South),
(int)Math.Round(landJoin.ParcelData.East), (int)Math.Round(landJoin.ParcelData.East),
(int)Math.Round(landJoin.ParcelData.North), this); (int)Math.Round(landJoin.ParcelData.North), this);
} }
break; break;
case PacketType.ParcelPropertiesUpdate: case PacketType.ParcelPropertiesUpdate:
@ -4581,7 +4582,7 @@ namespace OpenSim.Region.ClientStack
if (handlerParcelSelectObjects != null) if (handlerParcelSelectObjects != null)
{ {
handlerParcelSelectObjects(selectPacket.ParcelData.LocalID, handlerParcelSelectObjects(selectPacket.ParcelData.LocalID,
Convert.ToInt32(selectPacket.ParcelData.ReturnType), this); Convert.ToInt32(selectPacket.ParcelData.ReturnType), this);
} }
break; break;
case PacketType.ParcelObjectOwnersRequest: case PacketType.ParcelObjectOwnersRequest:
@ -4596,9 +4597,9 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#endregion #endregion
#region Estate Packets #region Estate Packets
case PacketType.EstateOwnerMessage: case PacketType.EstateOwnerMessage:
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
@ -4631,9 +4632,9 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#endregion #endregion
#region GodPackets #region GodPackets
case PacketType.RequestGodlikePowers: case PacketType.RequestGodlikePowers:
RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack; RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket)Pack;
@ -4661,7 +4662,7 @@ namespace OpenSim.Region.ClientStack
if (handlerGodKickUser != null) if (handlerGodKickUser != null)
{ {
handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason); gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason);
} }
} }
else else
@ -4681,9 +4682,9 @@ namespace OpenSim.Region.ClientStack
//OutPacket(kupack, ThrottleOutPacketType.Task); //OutPacket(kupack, ThrottleOutPacketType.Task);
break; break;
#endregion #endregion
#region Economy/Transaction Packets #region Economy/Transaction Packets
case PacketType.MoneyBalanceRequest: case PacketType.MoneyBalanceRequest:
MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack; MoneyBalanceRequestPacket moneybalancerequestpacket = (MoneyBalanceRequestPacket)Pack;
@ -4715,9 +4716,9 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
#endregion #endregion
#region unimplemented handlers #region unimplemented handlers
case PacketType.StartPingCheck: case PacketType.StartPingCheck:
// Send the client the ping response back // Send the client the ping response back
@ -4790,7 +4791,7 @@ namespace OpenSim.Region.ClientStack
m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString()); m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString());
break; break;
#endregion #endregion
} }
} }

View File

@ -36,25 +36,25 @@ using OpenSim.Framework.Statistics;
using OpenSim.Framework.Statistics.Interfaces; using OpenSim.Framework.Statistics.Interfaces;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class PacketQueue : IPullStatsProvider public class LLPacketQueue : IPullStatsProvider
{ {
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled = true; private bool m_enabled = true;
private BlockingQueue<QueItem> SendQueue; private BlockingQueue<LLQueItem> SendQueue;
private Queue<QueItem> IncomingPacketQueue; private Queue<LLQueItem> IncomingPacketQueue;
private Queue<QueItem> OutgoingPacketQueue; private Queue<LLQueItem> OutgoingPacketQueue;
private Queue<QueItem> ResendOutgoingPacketQueue; private Queue<LLQueItem> ResendOutgoingPacketQueue;
private Queue<QueItem> LandOutgoingPacketQueue; private Queue<LLQueItem> LandOutgoingPacketQueue;
private Queue<QueItem> WindOutgoingPacketQueue; private Queue<LLQueItem> WindOutgoingPacketQueue;
private Queue<QueItem> CloudOutgoingPacketQueue; private Queue<LLQueItem> CloudOutgoingPacketQueue;
private Queue<QueItem> TaskOutgoingPacketQueue; private Queue<LLQueItem> TaskOutgoingPacketQueue;
private Queue<QueItem> TextureOutgoingPacketQueue; private Queue<LLQueItem> TextureOutgoingPacketQueue;
private Queue<QueItem> AssetOutgoingPacketQueue; private Queue<LLQueItem> AssetOutgoingPacketQueue;
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
@ -67,14 +67,14 @@ namespace OpenSim.Region.ClientStack
private int throttletimems = 1000; private int throttletimems = 1000;
private PacketThrottle ResendThrottle; private LLPacketThrottle ResendThrottle;
private PacketThrottle LandThrottle; private LLPacketThrottle LandThrottle;
private PacketThrottle WindThrottle; private LLPacketThrottle WindThrottle;
private PacketThrottle CloudThrottle; private LLPacketThrottle CloudThrottle;
private PacketThrottle TaskThrottle; private LLPacketThrottle TaskThrottle;
private PacketThrottle AssetThrottle; private LLPacketThrottle AssetThrottle;
private PacketThrottle TextureThrottle; private LLPacketThrottle TextureThrottle;
private PacketThrottle TotalThrottle; private LLPacketThrottle TotalThrottle;
// private long LastThrottle; // private long LastThrottle;
// private long ThrottleInterval; // private long ThrottleInterval;
@ -82,37 +82,37 @@ namespace OpenSim.Region.ClientStack
private LLUUID m_agentId; private LLUUID m_agentId;
public PacketQueue(LLUUID agentId) public LLPacketQueue(LLUUID agentId)
{ {
// While working on this, the BlockingQueue had me fooled for a bit. // While working on this, the BlockingQueue had me fooled for a bit.
// The Blocking queue causes the thread to stop until there's something // The Blocking queue causes the thread to stop until there's something
// in it to process. it's an on-purpose threadlock though because // in it to process. it's an on-purpose threadlock though because
// without it, the clientloop will suck up all sim resources. // without it, the clientloop will suck up all sim resources.
SendQueue = new BlockingQueue<QueItem>(); SendQueue = new BlockingQueue<LLQueItem>();
IncomingPacketQueue = new Queue<QueItem>(); IncomingPacketQueue = new Queue<LLQueItem>();
OutgoingPacketQueue = new Queue<QueItem>(); OutgoingPacketQueue = new Queue<LLQueItem>();
ResendOutgoingPacketQueue = new Queue<QueItem>(); ResendOutgoingPacketQueue = new Queue<LLQueItem>();
LandOutgoingPacketQueue = new Queue<QueItem>(); LandOutgoingPacketQueue = new Queue<LLQueItem>();
WindOutgoingPacketQueue = new Queue<QueItem>(); WindOutgoingPacketQueue = new Queue<LLQueItem>();
CloudOutgoingPacketQueue = new Queue<QueItem>(); CloudOutgoingPacketQueue = new Queue<LLQueItem>();
TaskOutgoingPacketQueue = new Queue<QueItem>(); TaskOutgoingPacketQueue = new Queue<LLQueItem>();
TextureOutgoingPacketQueue = new Queue<QueItem>(); TextureOutgoingPacketQueue = new Queue<LLQueItem>();
AssetOutgoingPacketQueue = new Queue<QueItem>(); AssetOutgoingPacketQueue = new Queue<LLQueItem>();
// Set up the throttle classes (min, max, current) in bytes // Set up the throttle classes (min, max, current) in bytes
ResendThrottle = new PacketThrottle(5000, 100000, 16000); ResendThrottle = new LLPacketThrottle(5000, 100000, 16000);
LandThrottle = new PacketThrottle(1000, 100000, 2000); LandThrottle = new LLPacketThrottle(1000, 100000, 2000);
WindThrottle = new PacketThrottle(1000, 100000, 1000); WindThrottle = new LLPacketThrottle(1000, 100000, 1000);
CloudThrottle = new PacketThrottle(1000, 100000, 1000); CloudThrottle = new LLPacketThrottle(1000, 100000, 1000);
TaskThrottle = new PacketThrottle(1000, 800000, 3000); TaskThrottle = new LLPacketThrottle(1000, 800000, 3000);
AssetThrottle = new PacketThrottle(1000, 800000, 1000); AssetThrottle = new LLPacketThrottle(1000, 800000, 1000);
TextureThrottle = new PacketThrottle(1000, 800000, 4000); TextureThrottle = new LLPacketThrottle(1000, 800000, 4000);
// Total Throttle trumps all // Total Throttle trumps all
// Number of bytes allowed to go out per second. (256kbps per client) // Number of bytes allowed to go out per second. (256kbps per client)
TotalThrottle = new PacketThrottle(0, 1500000, 28000); TotalThrottle = new LLPacketThrottle(0, 1500000, 28000);
throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor)); throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed); throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack
/* STANDARD QUEUE MANIPULATION INTERFACES */ /* STANDARD QUEUE MANIPULATION INTERFACES */
public void Enqueue(QueItem item) public void Enqueue(LLQueItem item)
{ {
if (!m_enabled) if (!m_enabled)
{ {
@ -182,7 +182,7 @@ namespace OpenSim.Region.ClientStack
} }
} }
public QueItem Dequeue() public LLQueItem Dequeue()
{ {
return SendQueue.Dequeue(); return SendQueue.Dequeue();
} }
@ -287,7 +287,7 @@ namespace OpenSim.Region.ClientStack
//Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up. //Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up.
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0) if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = ResendOutgoingPacketQueue.Dequeue(); LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -295,7 +295,7 @@ namespace OpenSim.Region.ClientStack
} }
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0) if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = LandOutgoingPacketQueue.Dequeue(); LLQueItem qpack = LandOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -303,7 +303,7 @@ namespace OpenSim.Region.ClientStack
} }
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0) if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = WindOutgoingPacketQueue.Dequeue(); LLQueItem qpack = WindOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -311,7 +311,7 @@ namespace OpenSim.Region.ClientStack
} }
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0) if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = CloudOutgoingPacketQueue.Dequeue(); LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -319,7 +319,7 @@ namespace OpenSim.Region.ClientStack
} }
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0) if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = TaskOutgoingPacketQueue.Dequeue(); LLQueItem qpack = TaskOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack
} }
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0) if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = TextureOutgoingPacketQueue.Dequeue(); LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -335,7 +335,7 @@ namespace OpenSim.Region.ClientStack
} }
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0) if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
{ {
QueItem qpack = AssetOutgoingPacketQueue.Dequeue(); LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack); SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length); TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -353,7 +353,7 @@ namespace OpenSim.Region.ClientStack
ProcessThrottle(); ProcessThrottle();
} }
private void ThrottleCheck(ref PacketThrottle throttle, ref Queue<QueItem> q, QueItem item) private void ThrottleCheck(ref LLPacketThrottle throttle, ref Queue<LLQueItem> q, LLQueItem item)
{ {
// The idea.. is if the packet throttle queues are empty // The idea.. is if the packet throttle queues are empty
// and the client is under throttle for the type. Queue // and the client is under throttle for the type. Queue
@ -524,7 +524,7 @@ namespace OpenSim.Region.ClientStack
AssetOutgoingPacketQueue.Count); AssetOutgoingPacketQueue.Count);
} }
public QueItem[] GetQueueArray() public LLQueItem[] GetQueueArray()
{ {
return SendQueue.GetQueueArray(); return SendQueue.GetQueueArray();
} }

View File

@ -31,15 +31,16 @@ using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class PacketServer public class LLPacketServer
{ {
//private static readonly log4net.ILog m_log //private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private ClientStackNetworkHandler m_networkHandler; private LLClientStackNetworkHandler m_networkHandler;
private IScene m_scene; private IScene m_scene;
//private readonly ClientManager m_clientManager = new ClientManager(); //private readonly ClientManager m_clientManager = new ClientManager();
@ -48,7 +49,7 @@ namespace OpenSim.Region.ClientStack
// get { return m_clientManager; } // get { return m_clientManager; }
//} //}
public PacketServer(ClientStackNetworkHandler networkHandler) public LLPacketServer(LLClientStackNetworkHandler networkHandler)
{ {
m_networkHandler = networkHandler; m_networkHandler = networkHandler;
m_networkHandler.RegisterPacketServer(this); m_networkHandler.RegisterPacketServer(this);
@ -71,11 +72,11 @@ namespace OpenSim.Region.ClientStack
protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
ClientManager clientManager, IScene scene, AssetCache assetCache, ClientManager clientManager, IScene scene, AssetCache assetCache,
PacketServer packServer, AgentCircuitManager authenSessions, LLPacketServer packServer, AgentCircuitManager authenSessions,
LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP) LLUUID agentId, LLUUID sessionId, uint circuitCode, EndPoint proxyEP)
{ {
return return
new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP); new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
} }
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,

View File

@ -25,9 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class PacketThrottle public class LLPacketThrottle
{ {
private int max; // max allowable throttle private int max; // max allowable throttle
private int min; // min allowable throttle private int min; // min allowable throttle
@ -35,7 +35,7 @@ namespace OpenSim.Region.ClientStack
private static int divisor = 7; // the throttle time divisor, this probably should factor out private static int divisor = 7; // the throttle time divisor, this probably should factor out
private int sent; // current number of bytes sent private int sent; // current number of bytes sent
public PacketThrottle(int Min, int Max, int Throttle) public LLPacketThrottle(int Min, int Max, int Throttle)
{ {
max = Max; max = Max;
min = Min; min = Min;

View File

@ -28,11 +28,11 @@
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class QueItem public class LLQueItem
{ {
public QueItem() public LLQueItem()
{ {
} }

View File

@ -34,17 +34,18 @@ using libsecondlife.Packets;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.ClientStack.LindenUDP;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack.LindenUDP
{ {
public class UDPServer : ClientStackNetworkHandler public class LLUDPServer : LLClientStackNetworkHandler, IClientNetworkServer
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>(); public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>(); protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
public Socket Server; private Socket m_socket;
protected IPEndPoint ServerIncoming; protected IPEndPoint ServerIncoming;
protected byte[] RecvBuffer = new byte[4096]; protected byte[] RecvBuffer = new byte[4096];
protected byte[] ZeroBuffer = new byte[8192]; protected byte[] ZeroBuffer = new byte[8192];
@ -53,8 +54,8 @@ namespace OpenSim.Region.ClientStack
protected EndPoint epProxy; protected EndPoint epProxy;
protected int proxyPortOffset; protected int proxyPortOffset;
protected AsyncCallback ReceivedData; protected AsyncCallback ReceivedData;
protected PacketServer m_packetServer; protected LLPacketServer m_packetServer;
protected ulong m_regionHandle; protected Location m_location;
protected uint listenPort; protected uint listenPort;
protected bool Allow_Alternate_Port; protected bool Allow_Alternate_Port;
@ -63,7 +64,7 @@ namespace OpenSim.Region.ClientStack
protected AssetCache m_assetCache; protected AssetCache m_assetCache;
protected AgentCircuitManager m_authenticateSessionsClass; protected AgentCircuitManager m_authenticateSessionsClass;
public PacketServer PacketServer public LLPacketServer PacketServer
{ {
get { return m_packetServer; } get { return m_packetServer; }
set { m_packetServer = value; } set { m_packetServer = value; }
@ -75,20 +76,30 @@ namespace OpenSim.Region.ClientStack
{ {
m_localScene = value; m_localScene = value;
m_packetServer.LocalScene = m_localScene; m_packetServer.LocalScene = m_localScene;
m_regionHandle = m_localScene.RegionInfo.RegionHandle; m_location = new Location(m_localScene.RegionInfo.RegionHandle);
} }
} }
public ulong RegionHandle public ulong RegionHandle
{ {
get { return m_regionHandle; } get { return m_location.RegionHandle; }
} }
public UDPServer() Socket IClientNetworkServer.Server
{
get { return m_socket; }
}
public bool HandlesRegion(Location x)
{
return x == m_location;
}
public LLUDPServer()
{ {
} }
public UDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass) public LLUDPServer(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
{ {
this.proxyPortOffset = proxyPortOffset; this.proxyPortOffset = proxyPortOffset;
listenPort = (uint) (port + proxyPortOffset); listenPort = (uint) (port + proxyPortOffset);
@ -106,7 +117,7 @@ namespace OpenSim.Region.ClientStack
protected virtual void CreatePacketServer() protected virtual void CreatePacketServer()
{ {
PacketServer packetServer = new PacketServer(this); LLPacketServer packetServer = new LLPacketServer(this);
} }
protected virtual void OnReceivedData(IAsyncResult result) protected virtual void OnReceivedData(IAsyncResult result)
@ -119,7 +130,7 @@ namespace OpenSim.Region.ClientStack
try try
{ {
numBytes = Server.EndReceiveFrom(result, ref epSender); numBytes = m_socket.EndReceiveFrom(result, ref epSender);
} }
catch (SocketException e) catch (SocketException e)
{ {
@ -141,7 +152,7 @@ namespace OpenSim.Region.ClientStack
} }
try try
{ {
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null); ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -166,7 +177,7 @@ namespace OpenSim.Region.ClientStack
} }
try try
{ {
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null); ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -198,7 +209,7 @@ namespace OpenSim.Region.ClientStack
m_log.Debug("[UDPSERVER]: " + e.ToString()); m_log.Debug("[UDPSERVER]: " + e.ToString());
try try
{ {
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null); ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -239,7 +250,7 @@ namespace OpenSim.Region.ClientStack
try try
{ {
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
} }
catch (SocketException) catch (SocketException)
{ {
@ -253,7 +264,7 @@ namespace OpenSim.Region.ClientStack
} }
try try
{ {
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null); ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure.. // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -325,7 +336,7 @@ namespace OpenSim.Region.ClientStack
catch (Exception e3) catch (Exception e3)
{ {
m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString()); m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString());
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null); ReceivedData, null);
} }
} }
@ -385,8 +396,8 @@ namespace OpenSim.Region.ClientStack
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + "."); m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");
ServerIncoming = new IPEndPoint(listenIP, (int)newPort); ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Server.Bind(ServerIncoming); m_socket.Bind(ServerIncoming);
listenPort = newPort; listenPort = newPort;
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen"); m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
@ -394,12 +405,12 @@ namespace OpenSim.Region.ClientStack
ipeSender = new IPEndPoint(listenIP, 0); ipeSender = new IPEndPoint(listenIP, 0);
epSender = (EndPoint)ipeSender; epSender = (EndPoint)ipeSender;
ReceivedData = new AsyncCallback(OnReceivedData); ReceivedData = new AsyncCallback(OnReceivedData);
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
m_log.Info("[SERVER]: Listening on port " + newPort); m_log.Info("[SERVER]: Listening on port " + newPort);
} }
public virtual void RegisterPacketServer(PacketServer server) public virtual void RegisterPacketServer(LLPacketServer server)
{ {
m_packetServer = server; m_packetServer = server;
} }
@ -418,12 +429,12 @@ namespace OpenSim.Region.ClientStack
{ {
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString()); //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString());
PacketPool.EncodeProxyMessage(buffer, ref size, sendto); PacketPool.EncodeProxyMessage(buffer, ref size, sendto);
Server.SendTo(buffer, size, flags, proxyCircuits[circuitcode]); m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
} }
else else
{ {
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString()); //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString());
Server.SendTo(buffer, size, flags, sendto); m_socket.SendTo(buffer, size, flags, sendto);
} }
} }
} }

View File

@ -34,12 +34,11 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
//using OpenSim.Framework.Console;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack
{ {
public abstract class RegionApplicationBase : BaseOpenSimServer public abstract class RegionApplicationBase : BaseOpenSimServer
@ -75,7 +74,7 @@ namespace OpenSim.Region.ClientStack
public virtual void StartUp() public virtual void StartUp()
{ {
ClientView.TerrainManager = new TerrainManager(new SecondLife()); LLClientView.TerrainManager = new TerrainManager(new SecondLife());
m_storageManager = CreateStorageManager(m_storageConnectionString); m_storageManager = CreateStorageManager(m_storageConnectionString);
@ -108,12 +107,12 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine); return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
} }
protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions) protected Scene SetupScene(RegionInfo regionInfo, out LLUDPServer udpServer, bool m_permissions)
{ {
return SetupScene(regionInfo, 0, out udpServer, m_permissions); return SetupScene(regionInfo, 0, out udpServer, m_permissions);
} }
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out UDPServer udpServer, bool m_permissions) protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out LLUDPServer udpServer, bool m_permissions)
{ {
AgentCircuitManager circuitManager = new AgentCircuitManager(); AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address; IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@ -121,7 +120,7 @@ namespace OpenSim.Region.ClientStack
// listenIP = IPAddress.Parse("0.0.0.0"); // listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint) regionInfo.InternalEndPoint.Port; uint port = (uint) regionInfo.InternalEndPoint.Port;
udpServer = new UDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager); udpServer = new LLUDPServer(listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, m_assetCache, circuitManager);
regionInfo.InternalEndPoint.Port = (int)port; regionInfo.InternalEndPoint.Port = (int)port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
@ -131,8 +130,8 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap(); scene.LoadWorldMap();
//moved to opensimMain as these have to happen after modules are initialised //moved to opensimMain as these have to happen after modules are initialised
// scene.CreateTerrainTexture(true); // scene.CreateTerrainTexture(true);
// scene.RegisterRegionWithGrid(); // scene.RegisterRegionWithGrid();
scene.PhysicsScene = GetPhysicsScene(); scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());

View File

@ -11,5 +11,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
T[] RequestInterface<T>(); T[] RequestInterface<T>();
Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir); Location GetLocationByDirection(Scene scene, InterregionModule.Direction dir);
void internal_CreateRemotingObjects(); void internal_CreateRemotingObjects();
void RegisterRemoteRegion(string uri);
} }
} }

View File

@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion #endregion
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>(); private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
private readonly Object m_lockObject = new object();
private readonly List<Location> m_myLocations = new List<Location>(); private readonly List<Location> m_myLocations = new List<Location>();
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>(); private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>(); private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
private IConfigSource m_config; private IConfigSource m_config;
private bool m_enabled = false; private const bool m_enabled = false;
private Object m_lockObject = new object();
private RemotingObject m_myRemote; private RemotingObject m_myRemote;
private TcpChannel m_tcpChannel; private TcpChannel m_tcpChannel;
private int m_tcpPort = 10101; private int m_tcpPort = 10101;
@ -81,10 +81,7 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
{ {
return m_neighbourRemote[loc].RequestInterface<T>(); return m_neighbourRemote[loc].RequestInterface<T>();
} }
else throw new IndexOutOfRangeException("No neighbour availible at that location");
{
throw new IndexOutOfRangeException("No neighbour availible at that location");
}
} }
public T[] RequestInterface<T>() public T[] RequestInterface<T>()
@ -108,25 +105,24 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
return new Location(0, 0); return new Location(0, 0);
} }
#endregion public void RegisterRemoteRegion(string uri)
{
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
}
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated. #endregion
#region IRegionModule Members #region IRegionModule Members
public void Initialise(Scene scene, IConfigSource source) public void Initialise(Scene scene, IConfigSource source)
{ {
if (m_enabled) m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
{ (int) scene.RegionInfo.RegionLocY));
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX, m_config = source;
(int) scene.RegionInfo.RegionLocY));
m_config = source;
scene.RegisterModuleInterface<IInterregionModule>(this); scene.RegisterModuleInterface<IInterregionModule>(this);
}
} }
//TODO: This prevents us from registering new scenes after PostInitialise if we want comms updated.
public void PostInitialise() public void PostInitialise()
{ {
if (m_enabled) if (m_enabled)
@ -160,11 +156,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion #endregion
public void RegisterRemoteRegion(string uri)
{
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
}
private void RegisterRemotingInterface(RemotingObject remote) private void RegisterRemotingInterface(RemotingObject remote)
{ {
Location[] locs = remote.GetLocations(); Location[] locs = remote.GetLocations();

View File

@ -224,6 +224,12 @@ namespace OpenSim.Region.Examples.SimpleModule
get { return FirstName + LastName; } get { return FirstName + LastName; }
} }
public bool IsActive
{
get { return true; }
set { }
}
public virtual int NextAnimationSequenceNumber public virtual int NextAnimationSequenceNumber
{ {
get { return 1; } get { return 1; }