aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/CAPS/SimHttp.cs
diff options
context:
space:
mode:
authorMW2007-03-15 10:14:12 +0000
committerMW2007-03-15 10:14:12 +0000
commit8d1e9f83f338de21482547816834f4535cebf5bc (patch)
treeb09bb3a9e1ba4eff9032929b0c3b99cbe08b9965 /src/CAPS/SimHttp.cs
parentAdded simple mono/nant instructions (diff)
downloadopensim-SC_OLD-8d1e9f83f338de21482547816834f4535cebf5bc.zip
opensim-SC_OLD-8d1e9f83f338de21482547816834f4535cebf5bc.tar.gz
opensim-SC_OLD-8d1e9f83f338de21482547816834f4535cebf5bc.tar.bz2
opensim-SC_OLD-8d1e9f83f338de21482547816834f4535cebf5bc.tar.xz
Cleaned up IGridServer interfaces.
Added a try/catch around the http server Startup
Diffstat (limited to 'src/CAPS/SimHttp.cs')
-rw-r--r--src/CAPS/SimHttp.cs33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/CAPS/SimHttp.cs b/src/CAPS/SimHttp.cs
index eb20f3e..12bc9a8 100644
--- a/src/CAPS/SimHttp.cs
+++ b/src/CAPS/SimHttp.cs
@@ -38,6 +38,7 @@ using System.Collections;
38using System.Collections.Generic; 38using System.Collections.Generic;
39using libsecondlife; 39using libsecondlife;
40using ServerConsole; 40using ServerConsole;
41using OpenSim.GridServers;
41 42
42namespace OpenSim 43namespace OpenSim
43{ 44{
@@ -54,16 +55,23 @@ namespace OpenSim
54 } 55 }
55 56
56 public void StartHTTP() { 57 public void StartHTTP() {
57 ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK"); 58 try
58 Listener = new HttpListener(); 59 {
59 60 ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
60 Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/"); 61 Listener = new HttpListener();
61 Listener.Start(); 62
62 63 Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/");
63 HttpListenerContext context; 64 Listener.Start();
64 while(true) { 65
65 context = Listener.GetContext(); 66 HttpListenerContext context;
66 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context); 67 while(true) {
68 context = Listener.GetContext();
69 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
70 }
71 }
72 catch (Exception e)
73 {
74 ServerConsole.MainConsole.Instance.WriteLine(e.Message);
67 } 75 }
68 } 76 }
69 77
@@ -81,7 +89,10 @@ namespace OpenSim
81 agent_data.lastname = (string)requestData["lastname"]; 89 agent_data.lastname = (string)requestData["lastname"];
82 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 90 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
83 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 91 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
84 OpenSim_Main.gridServers.GridServer.agentcircuits.Add((uint)agent_data.circuitcode,agent_data); 92 if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
93 {
94 ((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data);
95 }
85 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; 96 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
86 break; 97 break;
87 } 98 }