From f42d1fc825b7b9d22ae05836992531d9abd2a26d Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Tue, 27 Mar 2007 21:42:14 +0000
Subject: * revert the revert - begin the beguine
---
OpenSim.RegionServer/CAPS/AdminWebFront.cs | 11 +++++---
OpenSim.RegionServer/CAPS/SimHttp.cs | 41 +++++++++++++++++-------------
2 files changed, 30 insertions(+), 22 deletions(-)
(limited to 'OpenSim.RegionServer/CAPS')
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
index ea32589..03f8692 100644
--- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs
+++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
+using OpenSim.world;
namespace OpenSim.CAPS
{
@@ -11,9 +12,11 @@ namespace OpenSim.CAPS
private string NewAccountForm;
private string LoginForm;
private string passWord = "Admin";
+ private World m_world;
- public AdminWebFront(string password)
+ public AdminWebFront(string password, World world)
{
+ m_world = world;
passWord = password;
LoadAdminPage();
}
@@ -45,11 +48,11 @@ namespace OpenSim.CAPS
{
responseString = "
Listing connected Clients
";
OpenSim.world.Avatar TempAv;
- foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
+ foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys)
{
- if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
+ if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar")
{
- TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
+ TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID];
responseString += "";
responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
responseString += "
";
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index a1073f0..92bbc6f 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -39,22 +39,27 @@ using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
+using OpenSim.Servers;
namespace OpenSim.CAPS
{
// Dummy HTTP server, does nothing useful for now
- public class SimCAPSHTTPServer
+ public class SimCAPSHTTPServer : BaseHttpServer
{
- public Thread HTTPD;
- public HttpListener Listener;
- private Dictionary restHandlers = new Dictionary();
+ private Thread m_workerThread;
+ private HttpListener m_httpListener;
+ private Dictionary m_restHandlers = new Dictionary();
+ private IGridServer m_gridServer;
+ private int m_port;
- public SimCAPSHTTPServer()
+ public SimCAPSHTTPServer(IGridServer gridServer, int port)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
- HTTPD = new Thread(new ThreadStart(StartHTTP));
- HTTPD.Start();
+ m_workerThread = new Thread(new ThreadStart(StartHTTP));
+ m_workerThread.Start();
+ m_gridServer = gridServer;
+ m_port = port;
}
public void StartHTTP()
@@ -62,15 +67,15 @@ namespace OpenSim.CAPS
try
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
- Listener = new HttpListener();
+ m_httpListener = new HttpListener();
- Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/");
- Listener.Start();
+ m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
+ m_httpListener.Start();
HttpListenerContext context;
while (true)
{
- context = Listener.GetContext();
+ context = m_httpListener.GetContext();
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
}
}
@@ -82,9 +87,9 @@ namespace OpenSim.CAPS
public bool AddRestHandler(string path, IRestHandler handler)
{
- if (!this.restHandlers.ContainsKey(path))
+ if (!this.m_restHandlers.ContainsKey(path))
{
- this.restHandlers.Add(path, handler);
+ this.m_restHandlers.Add(path, handler);
return true;
}
@@ -108,12 +113,12 @@ namespace OpenSim.CAPS
agent_data.lastname = (string)requestData["lastname"];
agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
- if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote")
+ if (m_gridServer.GetName() == "Remote")
{
- ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
+
+ ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
}
return "";
- break;
}
}
catch (Exception e)
@@ -135,9 +140,9 @@ namespace OpenSim.CAPS
//path[0] should be empty so we are interested in path[1]
if (path.Length > 1)
{
- if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1])))
+ if ((path[1] != "") && (this.m_restHandlers.ContainsKey(path[1])))
{
- responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod);
+ responseString = this.m_restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod);
}
}
--
cgit v1.1