aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorSean Dague2008-05-29 15:01:26 +0000
committerSean Dague2008-05-29 15:01:26 +0000
commit22c7845e0c58a5aef79921b327127ef93272f77e (patch)
treed87360fb11bb10278233556785efd0309ed6f120 /OpenSim/Framework/Servers
parentMantis#1411. Thank you kindly for Dataserver.cs and a patch (diff)
downloadopensim-SC_OLD-22c7845e0c58a5aef79921b327127ef93272f77e.zip
opensim-SC_OLD-22c7845e0c58a5aef79921b327127ef93272f77e.tar.gz
opensim-SC_OLD-22c7845e0c58a5aef79921b327127ef93272f77e.tar.bz2
opensim-SC_OLD-22c7845e0c58a5aef79921b327127ef93272f77e.tar.xz
attempting to get to the bottom of unresponsive grids servers by
adding back in a few messages on exceptions.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs53
1 files changed, 32 insertions, 21 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 50e2c0c..e57682f 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -84,10 +84,12 @@ namespace OpenSim.Framework.Servers
84 84
85 string handlerKey = GetHandlerKey(httpMethod, path); 85 string handlerKey = GetHandlerKey(httpMethod, path);
86 86
87 if (!m_streamHandlers.ContainsKey(handlerKey)) 87 lock(m_streamHandlers) {
88 { 88 if (!m_streamHandlers.ContainsKey(handlerKey))
89 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); 89 {
90 m_streamHandlers.Add(handlerKey, handler); 90 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
91 m_streamHandlers.Add(handlerKey, handler);
92 }
91 } 93 }
92 } 94 }
93 95
@@ -98,10 +100,12 @@ namespace OpenSim.Framework.Servers
98 100
99 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) 101 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
100 { 102 {
101 if (!m_rpcHandlers.ContainsKey(method)) 103 lock(m_rpcHandlers) {
102 { 104 if (!m_rpcHandlers.ContainsKey(method))
103 m_rpcHandlers.Add(method, handler); 105 {
104 return true; 106 m_rpcHandlers.Add(method, handler);
107 return true;
108 }
105 } 109 }
106 110
107 //must already have a handler for that path so return false 111 //must already have a handler for that path so return false
@@ -110,10 +114,12 @@ namespace OpenSim.Framework.Servers
110 114
111 public bool AddHTTPHandler(string method, GenericHTTPMethod handler) 115 public bool AddHTTPHandler(string method, GenericHTTPMethod handler)
112 { 116 {
113 if (!m_HTTPHandlers.ContainsKey(method)) 117 lock(m_HTTPHandlers) {
114 { 118 if (!m_HTTPHandlers.ContainsKey(method))
115 m_HTTPHandlers.Add(method, handler); 119 {
116 return true; 120 m_HTTPHandlers.Add(method, handler);
121 return true;
122 }
117 } 123 }
118 124
119 //must already have a handler for that path so return false 125 //must already have a handler for that path so return false
@@ -126,10 +132,12 @@ namespace OpenSim.Framework.Servers
126 132
127 public bool AddAgentHandler(string agent, IHttpAgentHandler handler) 133 public bool AddAgentHandler(string agent, IHttpAgentHandler handler)
128 { 134 {
129 if (!m_agentHandlers.ContainsKey(agent)) 135 lock(m_agentHandlers) {
130 { 136 if (!m_agentHandlers.ContainsKey(agent))
131 m_agentHandlers.Add(agent, handler); 137 {
132 return true; 138 m_agentHandlers.Add(agent, handler);
139 return true;
140 }
133 } 141 }
134 142
135 //must already have a handler for that path so return false 143 //must already have a handler for that path so return false
@@ -156,16 +164,17 @@ namespace OpenSim.Framework.Servers
156 OSHttpRequest request = new OSHttpRequest(context.Request); 164 OSHttpRequest request = new OSHttpRequest(context.Request);
157 OSHttpResponse response = new OSHttpResponse(context.Response); 165 OSHttpResponse response = new OSHttpResponse(context.Response);
158 166
167 // user agent based requests? not sure where this actually gets used from
159 if (request.UserAgent != null) 168 if (request.UserAgent != null)
160 { 169 {
161
162 IHttpAgentHandler agentHandler; 170 IHttpAgentHandler agentHandler;
163 171
164 if (TryGetAgentHandler(request, response, out agentHandler)) 172 if (TryGetAgentHandler(request, response, out agentHandler))
165 { 173 {
166 // m_log.DebugFormat("[HTTP-AGENT] Handler located for {0}", request.UserAgent); 174 if (HandleAgentRequest(agentHandler, request, response)) {
167 if (HandleAgentRequest(agentHandler, request, response)) 175 m_log.DebugFormat("[HTTP-AGENT] Handler located for {0}", request.UserAgent);
168 return; 176 return;
177 }
169 } 178 }
170 } 179 }
171 180
@@ -235,7 +244,7 @@ namespace OpenSim.Framework.Servers
235 return; 244 return;
236 } 245 }
237 } 246 }
238 catch (SocketException) 247 catch (SocketException e)
239 { 248 {
240 // At least on linux, it appears that if the client makes a request without requiring the response, 249 // At least on linux, it appears that if the client makes a request without requiring the response,
241 // an unconnected socket exception is thrown when we close the response output stream. There's no 250 // an unconnected socket exception is thrown when we close the response output stream. There's no
@@ -244,6 +253,7 @@ namespace OpenSim.Framework.Servers
244 // 253 //
245 // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go 254 // An alternative may be to turn off all response write exceptions on the HttpListener, but let's go
246 // with the minimum first 255 // with the minimum first
256 m_log.WarnFormat("[BASE HTTP SERVER]: HandleRequest threw {0}.\nNOTE: this may be spurious on Linux", e);
247 } 257 }
248 catch (Exception e) 258 catch (Exception e)
249 { 259 {
@@ -403,9 +413,10 @@ namespace OpenSim.Framework.Servers
403 { 413 {
404 response.OutputStream.Close(); 414 response.OutputStream.Close();
405 } 415 }
406 catch (SocketException) 416 catch (SocketException e)
407 { 417 {
408 // This has to be here to prevent a Linux/Mono crash 418 // This has to be here to prevent a Linux/Mono crash
419 m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e);
409 } 420 }
410 } 421 }
411 } 422 }