Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
						commit
						7d46b627e2
					
				| 
						 | 
				
			
			@ -26,6 +26,7 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using OpenSim.Framework;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,12 +46,27 @@ namespace OpenSim.Server.Base
 | 
			
		|||
        // The http server instance
 | 
			
		||||
        //
 | 
			
		||||
        protected BaseHttpServer m_HttpServer = null;
 | 
			
		||||
        protected uint m_Port = 0;
 | 
			
		||||
        protected Dictionary<uint, BaseHttpServer> m_Servers =
 | 
			
		||||
            new Dictionary<uint, BaseHttpServer>();
 | 
			
		||||
 | 
			
		||||
        public IHttpServer 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
 | 
			
		||||
        //
 | 
			
		||||
        public HttpServerBase(string prompt, string[] args) : base(prompt, args)
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +90,8 @@ namespace OpenSim.Server.Base
 | 
			
		|||
                Thread.CurrentThread.Abort();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            m_Port = port;
 | 
			
		||||
 | 
			
		||||
            m_HttpServer = new BaseHttpServer(port);
 | 
			
		||||
 | 
			
		||||
            MainServer.Instance = m_HttpServer;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@ using log4net;
 | 
			
		|||
using System.Reflection;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using OpenSim.Framework.Servers.HttpServer;
 | 
			
		||||
using OpenSim.Server.Base;
 | 
			
		||||
using OpenSim.Server.Handlers.Base;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -60,22 +61,61 @@ namespace OpenSim.Server
 | 
			
		|||
            string connList = serverConfig.GetString("ServiceConnectors", String.Empty);
 | 
			
		||||
            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;
 | 
			
		||||
 | 
			
		||||
                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 friendlyName = parts[0];
 | 
			
		||||
                if (parts.Length > 1)
 | 
			
		||||
                    friendlyName = parts[1];
 | 
			
		||||
 | 
			
		||||
                IHttpServer server = m_Server.HttpServer;
 | 
			
		||||
                if (port != 0)
 | 
			
		||||
                    server = m_Server.GetHttpServer(port);
 | 
			
		||||
 | 
			
		||||
                m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName);
 | 
			
		||||
 | 
			
		||||
                Object[] modargs = new Object[] { m_Server.Config, m_Server.HttpServer };
 | 
			
		||||
                IServiceConnector connector =
 | 
			
		||||
                        ServerUtils.LoadPlugin<IServiceConnector>(conn,
 | 
			
		||||
                        modargs);
 | 
			
		||||
                IServiceConnector connector = null;
 | 
			
		||||
                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,
 | 
			
		||||
                                modargs);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception)
 | 
			
		||||
                {
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (connector != null)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue