* 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.Statistics;
using OpenSim.Region.ClientStack;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
using OpenSim.Region.Environment;
@ -70,7 +71,7 @@ namespace OpenSim
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 bool m_physicalPrim;
@ -105,9 +106,9 @@ namespace OpenSim
get { return m_httpServer; }
}
public List<UDPServer> UdpServers
public List<IClientNetworkServer> UdpServers
{
get { return m_udpServers; }
get { return m_clientServers; }
}
public List<RegionInfo> RegionData
@ -327,7 +328,7 @@ namespace OpenSim
// We are done with startup
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();
m_log.Info("[OPENSIM MAIN]: Shutdown complete, goodbye.");
Environment.Exit(0);
@ -452,7 +453,7 @@ namespace OpenSim
/// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param>
/// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
public LLUDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag)
{
return CreateRegion(regionInfo, portadd_flag, false);
}
@ -463,7 +464,7 @@ namespace OpenSim
/// <param name="regionInfo"></param>
/// <param name="portadd_flag"></param>
/// <returns></returns>
public UDPServer CreateRegion(RegionInfo regionInfo)
public LLUDPServer CreateRegion(RegionInfo regionInfo)
{
return CreateRegion(regionInfo, false, true);
}
@ -475,7 +476,7 @@ namespace OpenSim
/// <param name="portadd_flag"></param>
/// <param name="do_post_init"></param>
/// <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;
@ -495,7 +496,7 @@ namespace OpenSim
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
}
UDPServer udpServer;
LLUDPServer udpServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out udpServer, m_permissions);
m_log.Info("[MODULES]: Loading Region's modules");
@ -548,7 +549,7 @@ namespace OpenSim
m_sceneManager.Add(scene);
m_udpServers.Add(udpServer);
m_clientServers.Add(udpServer);
m_regionData.Add(regionInfo);
udpServer.ServerListener();
@ -586,9 +587,9 @@ namespace OpenSim
bool foundUDPServer = false;
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;
foundUDPServer = true;
@ -598,8 +599,8 @@ namespace OpenSim
if (foundUDPServer)
{
// m_udpServers[UDPServerElement].Server.End
m_udpServers[UDPServerElement].Server.Close();
m_udpServers.RemoveAt(UDPServerElement);
m_clientServers[UDPServerElement].Server.Close();
m_clientServers.RemoveAt(UDPServerElement);
}
//Removing the region from the sim's database of regions..

View File

@ -32,14 +32,13 @@ using System.IO;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Timers;
using libsecondlife;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Timer=System.Timers.Timer;
@ -111,8 +110,8 @@ namespace OpenSim
{
m_scriptTimer = new Timer();
m_scriptTimer.Enabled = true;
m_scriptTimer.Interval = (int)(1200 * 1000);
m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript);
m_scriptTimer.Interval = 1200 * 1000;
m_scriptTimer.Elapsed += RunAutoTimerScript;
}
PrintFileToConsole("startuplogo.txt");
}
@ -156,7 +155,7 @@ namespace OpenSim
if (File.Exists(fileName))
{
StreamReader readFile = File.OpenText(fileName);
string currentCommand = String.Empty;
string currentCommand;
while ((currentCommand = readFile.ReadLine()) != null)
{
if (currentCommand != String.Empty)
@ -177,7 +176,7 @@ namespace OpenSim
if (File.Exists(fileName))
{
StreamReader readFile = File.OpenText(fileName);
string currentLine = String.Empty;
string currentLine;
while ((currentLine = readFile.ReadLine()) != null)
{
m_log.Info("[!]" + currentLine);
@ -609,55 +608,6 @@ namespace OpenSim
m_assetCache.ShowState();
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":
m_console.Notice("The currently loaded shared modules are:");
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;
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 RemoveClientCircuit(uint circuitcode);
void RegisterPacketServer(PacketServer server);
void RegisterPacketServer(LLPacketServer server);
}
}

View File

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

View File

@ -36,25 +36,25 @@ using OpenSim.Framework.Statistics;
using OpenSim.Framework.Statistics.Interfaces;
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 bool m_enabled = true;
private BlockingQueue<QueItem> SendQueue;
private BlockingQueue<LLQueItem> SendQueue;
private Queue<QueItem> IncomingPacketQueue;
private Queue<QueItem> OutgoingPacketQueue;
private Queue<QueItem> ResendOutgoingPacketQueue;
private Queue<QueItem> LandOutgoingPacketQueue;
private Queue<QueItem> WindOutgoingPacketQueue;
private Queue<QueItem> CloudOutgoingPacketQueue;
private Queue<QueItem> TaskOutgoingPacketQueue;
private Queue<QueItem> TextureOutgoingPacketQueue;
private Queue<QueItem> AssetOutgoingPacketQueue;
private Queue<LLQueItem> IncomingPacketQueue;
private Queue<LLQueItem> OutgoingPacketQueue;
private Queue<LLQueItem> ResendOutgoingPacketQueue;
private Queue<LLQueItem> LandOutgoingPacketQueue;
private Queue<LLQueItem> WindOutgoingPacketQueue;
private Queue<LLQueItem> CloudOutgoingPacketQueue;
private Queue<LLQueItem> TaskOutgoingPacketQueue;
private Queue<LLQueItem> TextureOutgoingPacketQueue;
private Queue<LLQueItem> AssetOutgoingPacketQueue;
private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
@ -67,14 +67,14 @@ namespace OpenSim.Region.ClientStack
private int throttletimems = 1000;
private PacketThrottle ResendThrottle;
private PacketThrottle LandThrottle;
private PacketThrottle WindThrottle;
private PacketThrottle CloudThrottle;
private PacketThrottle TaskThrottle;
private PacketThrottle AssetThrottle;
private PacketThrottle TextureThrottle;
private PacketThrottle TotalThrottle;
private LLPacketThrottle ResendThrottle;
private LLPacketThrottle LandThrottle;
private LLPacketThrottle WindThrottle;
private LLPacketThrottle CloudThrottle;
private LLPacketThrottle TaskThrottle;
private LLPacketThrottle AssetThrottle;
private LLPacketThrottle TextureThrottle;
private LLPacketThrottle TotalThrottle;
// private long LastThrottle;
// private long ThrottleInterval;
@ -82,37 +82,37 @@ namespace OpenSim.Region.ClientStack
private LLUUID m_agentId;
public PacketQueue(LLUUID agentId)
public LLPacketQueue(LLUUID agentId)
{
// While working on this, the BlockingQueue had me fooled for a bit.
// The Blocking queue causes the thread to stop until there's something
// in it to process. it's an on-purpose threadlock though because
// without it, the clientloop will suck up all sim resources.
SendQueue = new BlockingQueue<QueItem>();
SendQueue = new BlockingQueue<LLQueItem>();
IncomingPacketQueue = new Queue<QueItem>();
OutgoingPacketQueue = new Queue<QueItem>();
ResendOutgoingPacketQueue = new Queue<QueItem>();
LandOutgoingPacketQueue = new Queue<QueItem>();
WindOutgoingPacketQueue = new Queue<QueItem>();
CloudOutgoingPacketQueue = new Queue<QueItem>();
TaskOutgoingPacketQueue = new Queue<QueItem>();
TextureOutgoingPacketQueue = new Queue<QueItem>();
AssetOutgoingPacketQueue = new Queue<QueItem>();
IncomingPacketQueue = new Queue<LLQueItem>();
OutgoingPacketQueue = new Queue<LLQueItem>();
ResendOutgoingPacketQueue = new Queue<LLQueItem>();
LandOutgoingPacketQueue = new Queue<LLQueItem>();
WindOutgoingPacketQueue = new Queue<LLQueItem>();
CloudOutgoingPacketQueue = new Queue<LLQueItem>();
TaskOutgoingPacketQueue = new Queue<LLQueItem>();
TextureOutgoingPacketQueue = new Queue<LLQueItem>();
AssetOutgoingPacketQueue = new Queue<LLQueItem>();
// Set up the throttle classes (min, max, current) in bytes
ResendThrottle = new PacketThrottle(5000, 100000, 16000);
LandThrottle = new PacketThrottle(1000, 100000, 2000);
WindThrottle = new PacketThrottle(1000, 100000, 1000);
CloudThrottle = new PacketThrottle(1000, 100000, 1000);
TaskThrottle = new PacketThrottle(1000, 800000, 3000);
AssetThrottle = new PacketThrottle(1000, 800000, 1000);
TextureThrottle = new PacketThrottle(1000, 800000, 4000);
ResendThrottle = new LLPacketThrottle(5000, 100000, 16000);
LandThrottle = new LLPacketThrottle(1000, 100000, 2000);
WindThrottle = new LLPacketThrottle(1000, 100000, 1000);
CloudThrottle = new LLPacketThrottle(1000, 100000, 1000);
TaskThrottle = new LLPacketThrottle(1000, 800000, 3000);
AssetThrottle = new LLPacketThrottle(1000, 800000, 1000);
TextureThrottle = new LLPacketThrottle(1000, 800000, 4000);
// Total Throttle trumps all
// 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.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack
/* STANDARD QUEUE MANIPULATION INTERFACES */
public void Enqueue(QueItem item)
public void Enqueue(LLQueItem item)
{
if (!m_enabled)
{
@ -182,7 +182,7 @@ namespace OpenSim.Region.ClientStack
}
}
public QueItem Dequeue()
public LLQueItem 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.
if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
{
QueItem qpack = ResendOutgoingPacketQueue.Dequeue();
LLQueItem qpack = ResendOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -295,7 +295,7 @@ namespace OpenSim.Region.ClientStack
}
if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
{
QueItem qpack = LandOutgoingPacketQueue.Dequeue();
LLQueItem qpack = LandOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -303,7 +303,7 @@ namespace OpenSim.Region.ClientStack
}
if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
{
QueItem qpack = WindOutgoingPacketQueue.Dequeue();
LLQueItem qpack = WindOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -311,7 +311,7 @@ namespace OpenSim.Region.ClientStack
}
if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
{
QueItem qpack = CloudOutgoingPacketQueue.Dequeue();
LLQueItem qpack = CloudOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -319,7 +319,7 @@ namespace OpenSim.Region.ClientStack
}
if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
{
QueItem qpack = TaskOutgoingPacketQueue.Dequeue();
LLQueItem qpack = TaskOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack
}
if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
{
QueItem qpack = TextureOutgoingPacketQueue.Dequeue();
LLQueItem qpack = TextureOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -335,7 +335,7 @@ namespace OpenSim.Region.ClientStack
}
if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
{
QueItem qpack = AssetOutgoingPacketQueue.Dequeue();
LLQueItem qpack = AssetOutgoingPacketQueue.Dequeue();
SendQueue.Enqueue(qpack);
TotalThrottle.Add(qpack.Packet.ToBytes().Length);
@ -353,7 +353,7 @@ namespace OpenSim.Region.ClientStack
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
// and the client is under throttle for the type. Queue
@ -524,7 +524,7 @@ namespace OpenSim.Region.ClientStack
AssetOutgoingPacketQueue.Count);
}
public QueItem[] GetQueueArray()
public LLQueItem[] GetQueueArray()
{
return SendQueue.GetQueueArray();
}

View File

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

View File

@ -25,9 +25,9 @@
* 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 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 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;
min = Min;

View File

@ -28,11 +28,11 @@
using libsecondlife.Packets;
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 OpenSim.Framework;
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);
protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
public Dictionary<uint, EndPoint> clientCircuits_reverse = new Dictionary<uint, EndPoint>();
protected Dictionary<uint, EndPoint> proxyCircuits = new Dictionary<uint, EndPoint>();
public Socket Server;
private Socket m_socket;
protected IPEndPoint ServerIncoming;
protected byte[] RecvBuffer = new byte[4096];
protected byte[] ZeroBuffer = new byte[8192];
@ -53,8 +54,8 @@ namespace OpenSim.Region.ClientStack
protected EndPoint epProxy;
protected int proxyPortOffset;
protected AsyncCallback ReceivedData;
protected PacketServer m_packetServer;
protected ulong m_regionHandle;
protected LLPacketServer m_packetServer;
protected Location m_location;
protected uint listenPort;
protected bool Allow_Alternate_Port;
@ -63,7 +64,7 @@ namespace OpenSim.Region.ClientStack
protected AssetCache m_assetCache;
protected AgentCircuitManager m_authenticateSessionsClass;
public PacketServer PacketServer
public LLPacketServer PacketServer
{
get { return m_packetServer; }
set { m_packetServer = value; }
@ -75,20 +76,30 @@ namespace OpenSim.Region.ClientStack
{
m_localScene = value;
m_packetServer.LocalScene = m_localScene;
m_regionHandle = m_localScene.RegionInfo.RegionHandle;
m_location = new Location(m_localScene.RegionInfo.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;
listenPort = (uint) (port + proxyPortOffset);
@ -106,7 +117,7 @@ namespace OpenSim.Region.ClientStack
protected virtual void CreatePacketServer()
{
PacketServer packetServer = new PacketServer(this);
LLPacketServer packetServer = new LLPacketServer(this);
}
protected virtual void OnReceivedData(IAsyncResult result)
@ -119,7 +130,7 @@ namespace OpenSim.Region.ClientStack
try
{
numBytes = Server.EndReceiveFrom(result, ref epSender);
numBytes = m_socket.EndReceiveFrom(result, ref epSender);
}
catch (SocketException e)
{
@ -141,7 +152,7 @@ namespace OpenSim.Region.ClientStack
}
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -166,7 +177,7 @@ namespace OpenSim.Region.ClientStack
}
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// 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());
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -239,7 +250,7 @@ namespace OpenSim.Region.ClientStack
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)
{
@ -253,7 +264,7 @@ namespace OpenSim.Region.ClientStack
}
try
{
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
ReceivedData, null);
// Ter: For some stupid reason ConnectionReset basically kills our async event structure..
@ -325,7 +336,7 @@ namespace OpenSim.Region.ClientStack
catch (Exception e3)
{
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);
}
}
@ -385,8 +396,8 @@ namespace OpenSim.Region.ClientStack
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + ".");
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
Server.Bind(ServerIncoming);
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
m_socket.Bind(ServerIncoming);
listenPort = newPort;
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
@ -394,12 +405,12 @@ namespace OpenSim.Region.ClientStack
ipeSender = new IPEndPoint(listenIP, 0);
epSender = (EndPoint)ipeSender;
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);
}
public virtual void RegisterPacketServer(PacketServer server)
public virtual void RegisterPacketServer(LLPacketServer server)
{
m_packetServer = server;
}
@ -418,12 +429,12 @@ namespace OpenSim.Region.ClientStack
{
//MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo proxy " + proxyCircuits[circuitcode].ToString() + ": client " + sendto.ToString());
PacketPool.EncodeProxyMessage(buffer, ref size, sendto);
Server.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
m_socket.SendTo(buffer, size, flags, proxyCircuits[circuitcode]);
}
else
{
//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.Cache;
using OpenSim.Framework.Servers;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager;
//using OpenSim.Framework.Console;
namespace OpenSim.Region.ClientStack
{
public abstract class RegionApplicationBase : BaseOpenSimServer
@ -75,7 +74,7 @@ namespace OpenSim.Region.ClientStack
public virtual void StartUp()
{
ClientView.TerrainManager = new TerrainManager(new SecondLife());
LLClientView.TerrainManager = new TerrainManager(new SecondLife());
m_storageManager = CreateStorageManager(m_storageConnectionString);
@ -108,12 +107,12 @@ namespace OpenSim.Region.ClientStack
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);
}
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();
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@ -121,7 +120,7 @@ namespace OpenSim.Region.ClientStack
// listenIP = IPAddress.Parse("0.0.0.0");
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;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
@ -131,8 +130,8 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap();
//moved to opensimMain as these have to happen after modules are initialised
// scene.CreateTerrainTexture(true);
// scene.RegisterRegionWithGrid();
// scene.CreateTerrainTexture(true);
// scene.RegisterRegionWithGrid();
scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());

View File

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

View File

@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion
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 Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
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 TcpChannel m_tcpChannel;
private int m_tcpPort = 10101;
@ -81,10 +81,7 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
{
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>()
@ -108,25 +105,24 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
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
public void Initialise(Scene scene, IConfigSource source)
{
if (m_enabled)
{
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
(int) scene.RegionInfo.RegionLocY));
m_config = source;
m_myLocations.Add(new Location((int) scene.RegionInfo.RegionLocX,
(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()
{
if (m_enabled)
@ -160,11 +156,6 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion
public void RegisterRemoteRegion(string uri)
{
RegisterRemotingInterface((RemotingObject) Activator.GetObject(typeof (RemotingObject), uri));
}
private void RegisterRemotingInterface(RemotingObject remote)
{
Location[] locs = remote.GetLocations();

View File

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