diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.RegionServer/CAPS/AdminWebFront.cs | 11 | ||||
-rw-r--r-- | OpenSim.RegionServer/CAPS/SimHttp.cs | 41 |
2 files changed, 22 insertions, 30 deletions
diff --git a/OpenSim.RegionServer/CAPS/AdminWebFront.cs b/OpenSim.RegionServer/CAPS/AdminWebFront.cs index 03f8692..ea32589 100644 --- a/OpenSim.RegionServer/CAPS/AdminWebFront.cs +++ b/OpenSim.RegionServer/CAPS/AdminWebFront.cs | |||
@@ -2,7 +2,6 @@ using System; | |||
2 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
3 | using System.Text; | 3 | using System.Text; |
4 | using System.IO; | 4 | using System.IO; |
5 | using OpenSim.world; | ||
6 | 5 | ||
7 | namespace OpenSim.CAPS | 6 | namespace OpenSim.CAPS |
8 | { | 7 | { |
@@ -12,11 +11,9 @@ namespace OpenSim.CAPS | |||
12 | private string NewAccountForm; | 11 | private string NewAccountForm; |
13 | private string LoginForm; | 12 | private string LoginForm; |
14 | private string passWord = "Admin"; | 13 | private string passWord = "Admin"; |
15 | private World m_world; | ||
16 | 14 | ||
17 | public AdminWebFront(string password, World world) | 15 | public AdminWebFront(string password) |
18 | { | 16 | { |
19 | m_world = world; | ||
20 | passWord = password; | 17 | passWord = password; |
21 | LoadAdminPage(); | 18 | LoadAdminPage(); |
22 | } | 19 | } |
@@ -48,11 +45,11 @@ namespace OpenSim.CAPS | |||
48 | { | 45 | { |
49 | responseString = " <p> Listing connected Clients </p>"; | 46 | responseString = " <p> Listing connected Clients </p>"; |
50 | OpenSim.world.Avatar TempAv; | 47 | OpenSim.world.Avatar TempAv; |
51 | foreach (libsecondlife.LLUUID UUID in m_world.Entities.Keys) | 48 | foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) |
52 | { | 49 | { |
53 | if (m_world.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 50 | if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") |
54 | { | 51 | { |
55 | TempAv = (OpenSim.world.Avatar)m_world.Entities[UUID]; | 52 | TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; |
56 | responseString += "<p>"; | 53 | responseString += "<p>"; |
57 | 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()); | 54 | 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()); |
58 | responseString += "</p>"; | 55 | responseString += "</p>"; |
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs index 92bbc6f..a1073f0 100644 --- a/OpenSim.RegionServer/CAPS/SimHttp.cs +++ b/OpenSim.RegionServer/CAPS/SimHttp.cs | |||
@@ -39,27 +39,22 @@ using System.Collections.Generic; | |||
39 | using libsecondlife; | 39 | using libsecondlife; |
40 | using OpenSim.Framework.Console; | 40 | using OpenSim.Framework.Console; |
41 | using OpenSim.Framework.Interfaces; | 41 | using OpenSim.Framework.Interfaces; |
42 | using OpenSim.Servers; | ||
43 | 42 | ||
44 | namespace OpenSim.CAPS | 43 | namespace OpenSim.CAPS |
45 | { | 44 | { |
46 | // Dummy HTTP server, does nothing useful for now | 45 | // Dummy HTTP server, does nothing useful for now |
47 | 46 | ||
48 | public class SimCAPSHTTPServer : BaseHttpServer | 47 | public class SimCAPSHTTPServer |
49 | { | 48 | { |
50 | private Thread m_workerThread; | 49 | public Thread HTTPD; |
51 | private HttpListener m_httpListener; | 50 | public HttpListener Listener; |
52 | private Dictionary<string, IRestHandler> m_restHandlers = new Dictionary<string, IRestHandler>(); | 51 | private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>(); |
53 | private IGridServer m_gridServer; | ||
54 | private int m_port; | ||
55 | 52 | ||
56 | public SimCAPSHTTPServer(IGridServer gridServer, int port) | 53 | public SimCAPSHTTPServer() |
57 | { | 54 | { |
58 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); | 55 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server"); |
59 | m_workerThread = new Thread(new ThreadStart(StartHTTP)); | 56 | HTTPD = new Thread(new ThreadStart(StartHTTP)); |
60 | m_workerThread.Start(); | 57 | HTTPD.Start(); |
61 | m_gridServer = gridServer; | ||
62 | m_port = port; | ||
63 | } | 58 | } |
64 | 59 | ||
65 | public void StartHTTP() | 60 | public void StartHTTP() |
@@ -67,15 +62,15 @@ namespace OpenSim.CAPS | |||
67 | try | 62 | try |
68 | { | 63 | { |
69 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); | 64 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); |
70 | m_httpListener = new HttpListener(); | 65 | Listener = new HttpListener(); |
71 | 66 | ||
72 | m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); | 67 | Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/"); |
73 | m_httpListener.Start(); | 68 | Listener.Start(); |
74 | 69 | ||
75 | HttpListenerContext context; | 70 | HttpListenerContext context; |
76 | while (true) | 71 | while (true) |
77 | { | 72 | { |
78 | context = m_httpListener.GetContext(); | 73 | context = Listener.GetContext(); |
79 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); | 74 | ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); |
80 | } | 75 | } |
81 | } | 76 | } |
@@ -87,9 +82,9 @@ namespace OpenSim.CAPS | |||
87 | 82 | ||
88 | public bool AddRestHandler(string path, IRestHandler handler) | 83 | public bool AddRestHandler(string path, IRestHandler handler) |
89 | { | 84 | { |
90 | if (!this.m_restHandlers.ContainsKey(path)) | 85 | if (!this.restHandlers.ContainsKey(path)) |
91 | { | 86 | { |
92 | this.m_restHandlers.Add(path, handler); | 87 | this.restHandlers.Add(path, handler); |
93 | return true; | 88 | return true; |
94 | } | 89 | } |
95 | 90 | ||
@@ -113,12 +108,12 @@ namespace OpenSim.CAPS | |||
113 | agent_data.lastname = (string)requestData["lastname"]; | 108 | agent_data.lastname = (string)requestData["lastname"]; |
114 | agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); | 109 | agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); |
115 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 110 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
116 | if (m_gridServer.GetName() == "Remote") | 111 | if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote") |
117 | { | 112 | { |
118 | 113 | ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | |
119 | ((RemoteGridBase)m_gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | ||
120 | } | 114 | } |
121 | return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; | 115 | return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; |
116 | break; | ||
122 | } | 117 | } |
123 | } | 118 | } |
124 | catch (Exception e) | 119 | catch (Exception e) |
@@ -140,9 +135,9 @@ namespace OpenSim.CAPS | |||
140 | //path[0] should be empty so we are interested in path[1] | 135 | //path[0] should be empty so we are interested in path[1] |
141 | if (path.Length > 1) | 136 | if (path.Length > 1) |
142 | { | 137 | { |
143 | if ((path[1] != "") && (this.m_restHandlers.ContainsKey(path[1]))) | 138 | if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1]))) |
144 | { | 139 | { |
145 | responseString = this.m_restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); | 140 | responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod); |
146 | } | 141 | } |
147 | } | 142 | } |
148 | 143 | ||