Added some error handling (and console output) to BaseHttpServer.
a few other bits of refactoring.afrisby
parent
cac98171e5
commit
5ae8759de1
|
@ -185,26 +185,34 @@ namespace OpenSim.Framework.Servers
|
||||||
if (xmlRprcRequest != null)
|
if (xmlRprcRequest != null)
|
||||||
{
|
{
|
||||||
string methodName = xmlRprcRequest.MethodName;
|
string methodName = xmlRprcRequest.MethodName;
|
||||||
|
if (methodName != null)
|
||||||
XmlRpcResponse xmlRpcResponse;
|
|
||||||
|
|
||||||
XmlRpcMethod method;
|
|
||||||
if (m_rpcHandlers.TryGetValue(methodName, out method))
|
|
||||||
{
|
{
|
||||||
xmlRpcResponse = method(xmlRprcRequest);
|
|
||||||
|
XmlRpcResponse xmlRpcResponse;
|
||||||
|
|
||||||
|
XmlRpcMethod method;
|
||||||
|
if (m_rpcHandlers.TryGetValue(methodName, out method))
|
||||||
|
{
|
||||||
|
xmlRpcResponse = method(xmlRprcRequest);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xmlRpcResponse = new XmlRpcResponse();
|
||||||
|
Hashtable unknownMethodError = new Hashtable();
|
||||||
|
unknownMethodError["reason"] = "XmlRequest";
|
||||||
|
;
|
||||||
|
unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]";
|
||||||
|
unknownMethodError["login"] = "false";
|
||||||
|
xmlRpcResponse.Value = unknownMethodError;
|
||||||
|
}
|
||||||
|
|
||||||
|
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xmlRpcResponse = new XmlRpcResponse();
|
System.Console.WriteLine("Handler not found for http request " +request.RawUrl);
|
||||||
Hashtable unknownMethodError = new Hashtable();
|
responseString = "Error";
|
||||||
unknownMethodError["reason"] = "XmlRequest";
|
|
||||||
;
|
|
||||||
unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]";
|
|
||||||
unknownMethodError["login"] = "false";
|
|
||||||
xmlRpcResponse.Value = unknownMethodError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.AddHeader("Content-type", "text/xml");
|
response.AddHeader("Content-type", "text/xml");
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
public class AvatarFactoryModule : IAvatarFactory
|
public class AvatarFactoryModule : IAvatarFactory
|
||||||
{
|
{
|
||||||
private Scene m_scene = null;
|
private Scene m_scene = null;
|
||||||
private Dictionary<LLUUID, AvatarWearing> m_avatarsClothes = new Dictionary<LLUUID, AvatarWearing>();
|
private Dictionary<LLUUID, AvatarAppearance> m_avatarsClothes = new Dictionary<LLUUID, AvatarAppearance>();
|
||||||
|
|
||||||
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
|
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
|
||||||
out byte[] visualParams)
|
out byte[] visualParams)
|
||||||
|
@ -20,13 +20,13 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
if (!m_avatarsClothes.ContainsKey(avatarId))
|
if (!m_avatarsClothes.ContainsKey(avatarId))
|
||||||
{
|
{
|
||||||
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||||
AvatarWearing wearing = new AvatarWearing(wearables);
|
AvatarAppearance wearing = new AvatarAppearance(wearables);
|
||||||
m_avatarsClothes[avatarId] = wearing;
|
m_avatarsClothes[avatarId] = wearing;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
visualParams = SetDefaultVisualParams();
|
visualParams = GetDefaultVisualParams();
|
||||||
wearables = m_avatarsClothes[avatarId].IsWearing;
|
wearables = m_avatarsClothes[avatarId].IsWearing;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
//Tempoaray dictionary storage. This is be storing to a database
|
//Tempoaray dictionary storage. This is be storing to a database
|
||||||
if (m_avatarsClothes.ContainsKey(clientView.AgentId))
|
if (m_avatarsClothes.ContainsKey(clientView.AgentId))
|
||||||
{
|
{
|
||||||
AvatarWearing avWearing = m_avatarsClothes[clientView.AgentId];
|
AvatarAppearance avWearing = m_avatarsClothes[clientView.AgentId];
|
||||||
avWearing.IsWearing[wear.Type].AssetID = assetId;
|
avWearing.IsWearing[wear.Type].AssetID = assetId;
|
||||||
avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
|
avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
|
||||||
}
|
}
|
||||||
|
@ -103,12 +103,11 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||||
{
|
{
|
||||||
visualParams = SetDefaultVisualParams();
|
visualParams = GetDefaultVisualParams();
|
||||||
|
|
||||||
wearables = AvatarWearable.DefaultWearables;
|
wearables = AvatarWearable.DefaultWearables;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] SetDefaultVisualParams()
|
private static byte[] GetDefaultVisualParams()
|
||||||
{
|
{
|
||||||
byte[] visualParams;
|
byte[] visualParams;
|
||||||
visualParams = new byte[218];
|
visualParams = new byte[218];
|
||||||
|
@ -119,11 +118,12 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
return visualParams;
|
return visualParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AvatarWearing
|
public class AvatarAppearance
|
||||||
{
|
{
|
||||||
public AvatarWearable[] IsWearing;
|
public AvatarWearable[] IsWearing;
|
||||||
|
public byte[] VisualParams;
|
||||||
|
|
||||||
public AvatarWearing()
|
public AvatarAppearance()
|
||||||
{
|
{
|
||||||
IsWearing = new AvatarWearable[13];
|
IsWearing = new AvatarWearable[13];
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 13; i++)
|
||||||
|
@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AvatarWearing(AvatarWearable[] wearing)
|
public AvatarAppearance(AvatarWearable[] wearing)
|
||||||
{
|
{
|
||||||
if (wearing.Length == 13)
|
if (wearing.Length == 13)
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,9 +190,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
replyPacket.Data = searchData;
|
replyPacket.Data = searchData;
|
||||||
client.SendAvatarPickerReply(replyPacket);
|
client.SendAvatarPickerReply(replyPacket);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -512,7 +512,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
m_visualParams[i] = visualParam[i].ParamValue;
|
m_visualParams[i] = visualParam[i].ParamValue;
|
||||||
//OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "VisualData[" + i.ToString() + "]: " + visualParam[i].ParamValue.ToString() + "m");
|
//OpenSim.Framework.Console.MainLog.Instance.Verbose("CLIENT", "VisualData[" + i.ToString() + "]: " + visualParam[i].ParamValue.ToString() + "m");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
|
// Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
|
||||||
|
|
Loading…
Reference in New Issue