merge master
commit
c0bfaac0ac
|
@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL
|
|||
cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions""
|
||||
from inventoryitems
|
||||
where ""avatarID""::uuid = :PrincipalID
|
||||
and ""assetID"" = :AssetID
|
||||
and ""assetID""::uuid = :AssetID
|
||||
group by ""assetID"" ");
|
||||
|
||||
cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID));
|
||||
|
|
|
@ -34,6 +34,6 @@ namespace OpenSim.Framework.Client
|
|||
{
|
||||
public interface IClientIPEndpoint
|
||||
{
|
||||
IPAddress EndPoint { get; }
|
||||
IPEndPoint RemoteEndPoint { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,11 @@ namespace OpenSim.Framework.Monitoring
|
|||
HandleControlCommand);
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
JobEngine.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a new long-lived thread.
|
||||
/// </summary>
|
||||
|
@ -131,7 +136,6 @@ namespace OpenSim.Framework.Monitoring
|
|||
|
||||
thread.Start();
|
||||
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,12 +136,19 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
protected override void ShutdownSpecific()
|
||||
{
|
||||
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
|
||||
|
||||
RemovePIDFile();
|
||||
|
||||
base.ShutdownSpecific();
|
||||
|
||||
MainServer.Stop();
|
||||
|
||||
Thread.Sleep(5000);
|
||||
|
||||
WorkManager.Stop();
|
||||
|
||||
RemovePIDFile();
|
||||
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
|
||||
|
||||
if (!SuppressExit)
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
|
|
@ -194,17 +194,20 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
m_running = false;
|
||||
|
||||
Thread.Sleep(1000); // let the world move
|
||||
Thread.Sleep(100); // let the world move
|
||||
|
||||
foreach (Thread t in m_workerThreads)
|
||||
Watchdog.AbortThread(t.ManagedThreadId);
|
||||
|
||||
m_threadPool.Shutdown();
|
||||
|
||||
// any entry in m_bycontext should have a active request on the other queues
|
||||
// so just delete contents to easy GC
|
||||
foreach (Queue<PollServiceHttpRequest> qu in m_bycontext.Values)
|
||||
qu.Clear();
|
||||
m_bycontext.Clear();
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
foreach (PollServiceHttpRequest req in m_retryRequests)
|
||||
|
@ -217,8 +220,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
PollServiceHttpRequest wreq;
|
||||
*/
|
||||
m_retryRequests.Clear();
|
||||
|
||||
/*
|
||||
while (m_requests.Count() > 0)
|
||||
{
|
||||
try
|
||||
|
@ -231,7 +235,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
m_requests.Clear();
|
||||
}
|
||||
|
||||
|
@ -242,7 +246,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
while (m_running)
|
||||
{
|
||||
PollServiceHttpRequest req = m_requests.Dequeue(5000);
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
if(req == null)
|
||||
continue;
|
||||
|
@ -277,16 +280,16 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
try
|
||||
{
|
||||
req.DoHTTPGruntWork(m_server, responsedata);
|
||||
}
|
||||
catch (ObjectDisposedException) { }
|
||||
finally
|
||||
{
|
||||
if(req.HttpContext.CanSend() && req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Poll
|
||||
&& (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||
ReQueueEvent(req);
|
||||
else
|
||||
byContextDequeue(req);
|
||||
}
|
||||
catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
}
|
||||
return null;
|
||||
}, null);
|
||||
}
|
||||
|
@ -300,11 +303,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
req.DoHTTPGruntWork(m_server,
|
||||
req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
|
||||
byContextDequeue(req);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
catch (ObjectDisposedException) {}
|
||||
finally
|
||||
{
|
||||
// Ignore it, no need to reply
|
||||
byContextDequeue(req);
|
||||
}
|
||||
return null;
|
||||
}, null);
|
||||
|
|
|
@ -369,5 +369,17 @@ namespace OpenSim.Framework.Servers
|
|||
return m_Servers[port];
|
||||
}
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
lock (m_Servers)
|
||||
{
|
||||
foreach (BaseHttpServer httpServer in m_Servers.Values)
|
||||
{
|
||||
httpServer.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -77,7 +77,11 @@ namespace OpenSim
|
|||
if(Util.IsWindows())
|
||||
ServicePointManager.DefaultConnectionLimit = 32;
|
||||
else
|
||||
{
|
||||
ServicePointManager.DefaultConnectionLimit = 12;
|
||||
try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case crazy some mono decides to have it infinity
|
||||
catch { }
|
||||
}
|
||||
|
||||
ServicePointManager.Expect100Continue = false;
|
||||
ServicePointManager.UseNagleAlgorithm = false;
|
||||
|
|
|
@ -504,7 +504,8 @@ namespace OpenSim
|
|||
private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
|
||||
{
|
||||
int now = Environment.TickCount & Int32.MaxValue;
|
||||
|
||||
if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped)
|
||||
return;
|
||||
m_log.ErrorFormat(
|
||||
"[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
|
||||
twi.Thread.Name,
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// Handles new client connections
|
||||
/// Constructor takes a single Packet and authenticates everything
|
||||
/// </summary>
|
||||
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IStatsCollector
|
||||
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IStatsCollector, IClientIPEndpoint
|
||||
{
|
||||
/// <value>
|
||||
/// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
|
||||
|
|
|
@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
|
|||
if (bans.Count > 0)
|
||||
{
|
||||
IClientIPEndpoint ipEndpoint;
|
||||
if (client.TryGet(out ipEndpoint))
|
||||
if (client.TryGet(out ipEndpoint) && ipEndpoint.RemoteEndPoint != null)
|
||||
{
|
||||
IPAddress end = ipEndpoint.EndPoint;
|
||||
IPAddress end = ipEndpoint.RemoteEndPoint.Address;
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -813,8 +813,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agentCircuit.Id0 = currentAgentCircuit.Id0;
|
||||
}
|
||||
|
||||
IClientIPEndpoint ipepClient;
|
||||
|
||||
uint newRegionX, newRegionY, oldRegionX, oldRegionY;
|
||||
Util.RegionHandleToRegionLoc(destinationHandle, out newRegionX, out newRegionY);
|
||||
Util.RegionHandleToRegionLoc(sourceRegion.RegionHandle, out oldRegionX, out oldRegionY);
|
||||
|
@ -833,13 +831,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
finalDestination.RegionName, newRegionX, newRegionY,newSizeX, newSizeY, sp.Name, Scene.Name);
|
||||
|
||||
//sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
|
||||
#region IP Translation for NAT
|
||||
// Uses ipepClient above
|
||||
if (sp.ClientView.TryGet(out ipepClient))
|
||||
{
|
||||
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||
}
|
||||
#endregion
|
||||
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
|
||||
}
|
||||
else
|
||||
|
@ -952,7 +943,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
agent.Position = agentCircuit.startpos;
|
||||
SetCallbackURL(agent, sp.Scene.RegionInfo);
|
||||
|
||||
|
||||
// We will check for an abort before UpdateAgent since UpdateAgent will require an active viewer to
|
||||
// establish th econnection to the destination which makes it return true.
|
||||
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
|
||||
|
@ -1745,11 +1735,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
if (m_eqModule != null)
|
||||
{
|
||||
#region IP Translation for NAT
|
||||
IClientIPEndpoint ipepClient;
|
||||
if (agent.ClientView.TryGet(out ipepClient))
|
||||
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||
|
||||
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
|
||||
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
|
||||
source.RegionName, agent.Name,
|
||||
|
@ -2281,6 +2266,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
}
|
||||
|
||||
#endregion // NotFoundLocationCache class
|
||||
#region getregions
|
||||
private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
|
||||
|
||||
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
|
||||
|
@ -2398,17 +2384,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
if (m_eqModule != null)
|
||||
{
|
||||
#region IP Translation for NAT
|
||||
if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened
|
||||
return;
|
||||
|
||||
IClientIPEndpoint ipepClient;
|
||||
if (sp.ClientView.TryGet(out ipepClient))
|
||||
{
|
||||
endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
|
||||
}
|
||||
#endregion
|
||||
|
||||
m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
|
||||
"and EstablishAgentCommunication with seed cap {8}", LogHeader,
|
||||
scene.RegionInfo.RegionName, sp.Name,
|
||||
|
|
|
@ -106,6 +106,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
|||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
base.RemoveRegion(scene);
|
||||
|
||||
scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
|
||||
}
|
||||
|
||||
|
|
|
@ -415,6 +415,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
|
||||
public void Close()
|
||||
{
|
||||
ThreadPool.Shutdown();
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -538,6 +539,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
|||
{
|
||||
Request = (HttpWebRequest)WebRequest.Create(Url);
|
||||
Request.AllowAutoRedirect = false;
|
||||
Request.KeepAlive = false;
|
||||
|
||||
//This works around some buggy HTTP Servers like Lighttpd
|
||||
Request.ServicePoint.Expect100Continue = false;
|
||||
|
|
|
@ -215,6 +215,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
m_scene.EventManager.OnNewClient -= OnNewClient;
|
||||
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
|
||||
|
||||
m_scene.UnregisterModuleInterface<IWorldMapModule>(this);
|
||||
|
||||
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
|
||||
regionimage = regionimage.Replace("-", "");
|
||||
MainServer.Instance.RemoveLLSDHandler("/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(),
|
||||
|
@ -1148,7 +1150,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>();
|
||||
while (true)
|
||||
{
|
||||
m_mapBlockRequestEvent.WaitOne();
|
||||
while(!m_mapBlockRequestEvent.WaitOne(4900))
|
||||
{
|
||||
if(m_scene == null)
|
||||
return;
|
||||
}
|
||||
|
||||
lock (m_mapBlockRequestEvent)
|
||||
{
|
||||
int total = 0;
|
||||
|
|
|
@ -4687,7 +4687,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
cAgent.agentCOF = COF;
|
||||
cAgent.ActiveGroupID = ControllingClient.ActiveGroupId;
|
||||
cAgent.ActiveGroupName = ControllingClient.ActiveGroupName;
|
||||
cAgent.ActiveGroupTitle = Grouptitle;
|
||||
if(Grouptitle == null)
|
||||
cAgent.ActiveGroupTitle = String.Empty;
|
||||
else
|
||||
cAgent.ActiveGroupTitle = Grouptitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -550,7 +550,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
private void RecordMaterialAssetUuids(AssetBase materialAsset)
|
||||
{
|
||||
OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data);
|
||||
OSDMap mat;
|
||||
try
|
||||
{
|
||||
mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[Materials]: cannot decode material asset {0}: {1}", materialAsset.ID, e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
UUID normMap = mat["NormMap"].AsUUID();
|
||||
if (normMap != UUID.Zero)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
private static Thread cmdHandlerThread;
|
||||
private static int cmdHandlerThreadCycleSleepms;
|
||||
|
||||
private static int numInstances;
|
||||
/// <summary>
|
||||
/// Lock for reading/writing static components of AsyncCommandManager.
|
||||
/// </summary>
|
||||
|
@ -172,18 +172,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (!m_XmlRequest.ContainsKey(m_ScriptEngine))
|
||||
m_XmlRequest[m_ScriptEngine] = new XmlRequest(this);
|
||||
|
||||
StartThread();
|
||||
}
|
||||
}
|
||||
|
||||
private static void StartThread()
|
||||
{
|
||||
if (cmdHandlerThread == null)
|
||||
{
|
||||
// Start the thread that will be doing the work
|
||||
cmdHandlerThread
|
||||
= WorkManager.StartThread(
|
||||
numInstances++;
|
||||
if (cmdHandlerThread == null)
|
||||
{
|
||||
cmdHandlerThread = WorkManager.StartThread(
|
||||
CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,20 +191,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
~AsyncCommandManager()
|
||||
{
|
||||
// Shut down thread
|
||||
// try
|
||||
// {
|
||||
// if (cmdHandlerThread != null)
|
||||
// {
|
||||
// if (cmdHandlerThread.IsAlive == true)
|
||||
// {
|
||||
// cmdHandlerThread.Abort();
|
||||
// //cmdHandlerThread.Join();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// }
|
||||
try
|
||||
{
|
||||
lock (staticLock)
|
||||
{
|
||||
numInstances--;
|
||||
if(numInstances > 0)
|
||||
return;
|
||||
if (cmdHandlerThread != null)
|
||||
{
|
||||
if (cmdHandlerThread.IsAlive == true)
|
||||
{
|
||||
cmdHandlerThread.Abort();
|
||||
//cmdHandlerThread.Join();
|
||||
cmdHandlerThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -240,24 +241,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
lock (staticLock)
|
||||
{
|
||||
// Check HttpRequests
|
||||
m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests();
|
||||
try { m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests(); } catch {}
|
||||
|
||||
// Check XMLRPCRequests
|
||||
m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests();
|
||||
try { m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); } catch {}
|
||||
|
||||
foreach (IScriptEngine s in m_ScriptEngines)
|
||||
{
|
||||
// Check Listeners
|
||||
m_Listener[s].CheckListeners();
|
||||
try { m_Listener[s].CheckListeners(); } catch {}
|
||||
|
||||
|
||||
// Check timers
|
||||
m_Timer[s].CheckTimerEvents();
|
||||
try { m_Timer[s].CheckTimerEvents(); } catch {}
|
||||
|
||||
// Check Sensors
|
||||
m_SensorRepeat[s].CheckSenseRepeaterEvents();
|
||||
try { m_SensorRepeat[s].CheckSenseRepeaterEvents(); } catch {}
|
||||
|
||||
// Check dataserver
|
||||
m_Dataserver[s].ExpireRequests();
|
||||
try { m_Dataserver[s].ExpireRequests(); } catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -387,8 +389,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
|
||||
{
|
||||
List<Object> data = new List<Object>();
|
||||
|
|
|
@ -827,6 +827,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
if (m_ScriptEngines.Contains(this))
|
||||
m_ScriptEngines.Remove(this);
|
||||
}
|
||||
|
||||
lock(m_Scripts)
|
||||
m_ThreadPool.Shutdown();
|
||||
}
|
||||
|
||||
public object DoBackup(object o)
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Login
|
|||
public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
if (m_Proxy && request.Params[3] != null)
|
||||
if (request.Params[3] != null)
|
||||
{
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]);
|
||||
if (ep != null)
|
||||
|
|
|
@ -225,8 +225,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
|
||||
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
||||
{
|
||||
if (!m_Proxy)
|
||||
return request.RemoteIPEndPoint.Address;
|
||||
// if (!m_Proxy)
|
||||
// return request.RemoteIPEndPoint.Address;
|
||||
|
||||
// We're behind a proxy
|
||||
string xff = "X-Forwarded-For";
|
||||
|
@ -236,7 +236,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
|
||||
if (xffValue == null || (xffValue != null && xffValue == string.Empty))
|
||||
{
|
||||
m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
|
||||
// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
|
||||
return request.RemoteIPEndPoint.Address;
|
||||
}
|
||||
|
||||
|
|
|
@ -229,8 +229,8 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
|
||||
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
||||
{
|
||||
if (!m_Proxy)
|
||||
return request.RemoteIPEndPoint.Address;
|
||||
// if (!m_Proxy)
|
||||
// return request.RemoteIPEndPoint.Address;
|
||||
|
||||
// We're behind a proxy
|
||||
string xff = "X-Forwarded-For";
|
||||
|
@ -240,7 +240,7 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
|
||||
if (xffValue == null || (xffValue != null && xffValue == string.Empty))
|
||||
{
|
||||
m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
|
||||
// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
|
||||
return request.RemoteIPEndPoint.Address;
|
||||
}
|
||||
|
||||
|
|
|
@ -517,32 +517,30 @@ namespace OpenSim.Server.Handlers.Simulation
|
|||
|
||||
protected string GetCallerIP(Hashtable request)
|
||||
{
|
||||
if (!m_Proxy)
|
||||
return Util.GetCallerIP(request);
|
||||
|
||||
// We're behind a proxy
|
||||
Hashtable headers = (Hashtable)request["headers"];
|
||||
|
||||
//// DEBUG
|
||||
//foreach (object o in headers.Keys)
|
||||
// m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
|
||||
|
||||
string xff = "X-Forwarded-For";
|
||||
if (headers.ContainsKey(xff.ToLower()))
|
||||
xff = xff.ToLower();
|
||||
|
||||
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
||||
if (request.ContainsKey("headers"))
|
||||
{
|
||||
m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||
return Util.GetCallerIP(request);
|
||||
Hashtable headers = (Hashtable)request["headers"];
|
||||
|
||||
//// DEBUG
|
||||
//foreach (object o in headers.Keys)
|
||||
// m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString()));
|
||||
|
||||
string xff = "X-Forwarded-For";
|
||||
if (!headers.ContainsKey(xff))
|
||||
xff = xff.ToLower();
|
||||
|
||||
if (!headers.ContainsKey(xff) || headers[xff] == null)
|
||||
{
|
||||
// m_log.WarnFormat("[AGENT HANDLER]: No XFF header");
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]);
|
||||
|
||||
IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]);
|
||||
if (ep != null)
|
||||
return ep.Address.ToString();
|
||||
|
||||
// Oops
|
||||
return Util.GetCallerIP(request);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,9 @@ namespace OpenSim.Server
|
|||
ServicePointManager.UseNagleAlgorithm = false;
|
||||
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
|
||||
|
||||
try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity
|
||||
catch { }
|
||||
|
||||
m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
|
||||
|
||||
string registryLocation;
|
||||
|
|
Loading…
Reference in New Issue