Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

0.6.8-post-fixes
Diva Canto 2009-09-28 15:51:07 -07:00
commit 7d46b627e2
2 changed files with 64 additions and 6 deletions

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Reflection; using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
@ -45,12 +46,27 @@ namespace OpenSim.Server.Base
// The http server instance // The http server instance
// //
protected BaseHttpServer m_HttpServer = null; protected BaseHttpServer m_HttpServer = null;
protected uint m_Port = 0;
protected Dictionary<uint, BaseHttpServer> m_Servers =
new Dictionary<uint, BaseHttpServer>();
public IHttpServer HttpServer public IHttpServer HttpServer
{ {
get { return m_HttpServer; } get { return m_HttpServer; }
} }
public IHttpServer GetHttpServer(uint port)
{
if (port == m_Port)
return HttpServer;
if (m_Servers.ContainsKey(port))
return m_Servers[port];
m_Servers[port] = new BaseHttpServer(port);
return m_Servers[port];
}
// Handle all the automagical stuff // Handle all the automagical stuff
// //
public HttpServerBase(string prompt, string[] args) : base(prompt, args) public HttpServerBase(string prompt, string[] args) : base(prompt, args)
@ -74,6 +90,8 @@ namespace OpenSim.Server.Base
Thread.CurrentThread.Abort(); Thread.CurrentThread.Abort();
} }
m_Port = port;
m_HttpServer = new BaseHttpServer(port); m_HttpServer = new BaseHttpServer(port);
MainServer.Instance = m_HttpServer; MainServer.Instance = m_HttpServer;

View File

@ -30,6 +30,7 @@ using log4net;
using System.Reflection; using System.Reflection;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
@ -60,22 +61,61 @@ namespace OpenSim.Server
string connList = serverConfig.GetString("ServiceConnectors", String.Empty); string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
string[] conns = connList.Split(new char[] {',', ' '}); string[] conns = connList.Split(new char[] {',', ' '});
foreach (string conn in conns) foreach (string c in conns)
{ {
if (conn == String.Empty) if (c == String.Empty)
continue; continue;
string configName = String.Empty;
string conn = c;
uint port = 0;
string[] split1 = conn.Split(new char[] {'/'});
if (split1.Length > 1)
{
conn = split1[1];
string[] split2 = split1[0].Split(new char[] {'@'});
if (split2.Length > 1)
{
configName = split2[0];
port = Convert.ToUInt32(split2[1]);
}
else
{
port = Convert.ToUInt32(split1[0]);
}
}
string[] parts = conn.Split(new char[] {':'}); string[] parts = conn.Split(new char[] {':'});
string friendlyName = parts[0]; string friendlyName = parts[0];
if (parts.Length > 1) if (parts.Length > 1)
friendlyName = parts[1]; friendlyName = parts[1];
IHttpServer server = m_Server.HttpServer;
if (port != 0)
server = m_Server.GetHttpServer(port);
m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
Object[] modargs = new Object[] { m_Server.Config, m_Server.HttpServer }; IServiceConnector connector = null;
IServiceConnector connector = try
{
Object[] modargs = new Object[] { m_Server.Config, server,
configName };
connector = ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs);
if (connector == null)
{
modargs = new Object[] { m_Server.Config, server };
connector =
ServerUtils.LoadPlugin<IServiceConnector>(conn, ServerUtils.LoadPlugin<IServiceConnector>(conn,
modargs); modargs);
}
}
catch (Exception)
{
}
if (connector != null) if (connector != null)
{ {