Merge branch 'master' into httptests

This commit is contained in:
UbitUmarov
2017-06-16 02:43:36 +01:00
10 changed files with 53 additions and 208 deletions

View File

@@ -705,29 +705,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </param>
/// <returns>true if the handler was added. This is currently always the case.</returns>
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync)
{
return AddLocalPacketHandler(packetType, handler, doAsync, false);
}
/// <summary>
/// Add a handler for the given packet type.
/// </summary>
/// <param name="packetType"></param>
/// <param name="handler"></param>
/// <param name="doAsync">
/// If true, when the packet is received handle it on a different thread. Whether this is given direct to
/// a threadpool thread or placed in a queue depends on the inEngine parameter.
/// </param>
/// <param name="inEngine">
/// If async is false then this parameter is ignored.
/// If async is true and inEngine is false, then the packet is sent directly to a
/// threadpool thread.
/// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine.
/// This may result in slower handling but reduces the risk of overloading the simulator when there are many
/// simultaneous async requests.
/// </param>
/// <returns>true if the handler was added. This is currently always the case.</returns>
public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine)
{
bool result = false;
lock (m_packetHandlers)
@@ -735,7 +712,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!m_packetHandlers.ContainsKey(packetType))
{
m_packetHandlers.Add(
packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
packetType, new PacketProcessor() { method = handler, Async = doAsync});
result = true;
}
}
@@ -770,31 +747,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
PacketProcessor pprocessor;
if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor))
{
ClientInfo cinfo = UDPClient.GetClientInfo();
//there is a local handler for this packet type
if (pprocessor.Async)
{
if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString()))
cinfo.AsyncRequests[packet.Type.ToString()] = 0;
cinfo.AsyncRequests[packet.Type.ToString()]++;
object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
/*
if (pprocessor.InEngine)
m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
else
Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
*/
m_asyncPacketProcess.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
result = true;
}
else
{
if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString()))
cinfo.SyncRequests[packet.Type.ToString()] = 0;
cinfo.SyncRequests[packet.Type.ToString()]++;
result = pprocessor.method(this, packet);
}
}
@@ -809,11 +771,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
if (found)
{
ClientInfo cinfo = UDPClient.GetClientInfo();
if (!cinfo.GenericRequests.ContainsKey(packet.Type.ToString()))
cinfo.GenericRequests[packet.Type.ToString()] = 0;
cinfo.GenericRequests[packet.Type.ToString()]++;
result = method(this, packet);
}
}
@@ -5995,10 +5952,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false);
AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage, true, true);
AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest, true, true);
AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest);
AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate, true, true);
AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate);
AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
@@ -6040,8 +5997,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ObjectExtraParams, HandleObjectExtraParams);
AddLocalPacketHandler(PacketType.ObjectDuplicate, HandleObjectDuplicate);
AddLocalPacketHandler(PacketType.RequestMultipleObjects, HandleRequestMultipleObjects);
AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect, true, true);
AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect, true, true);
AddLocalPacketHandler(PacketType.ObjectSelect, HandleObjectSelect);
AddLocalPacketHandler(PacketType.ObjectDeselect, HandleObjectDeselect);
AddLocalPacketHandler(PacketType.ObjectPosition, HandleObjectPosition);
AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
@@ -6185,8 +6142,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete);
AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete);
AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate);
AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate, true, true);
AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate, true, true);
AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate);
AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate);
AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights);
AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery);
AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry);
@@ -13436,7 +13393,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SendAssetNotFound(req);
return;
}
}
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
@@ -13513,11 +13469,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
public bool Async { get; set; }
/// <summary>
/// If async is true, should this packet be handled in the async engine or given directly to a threadpool
/// thread?
/// </summary>
public bool InEngine { get; set; }
}
public class AsyncPacketProcess