avoid a null ref, plus some cleanup
							parent
							
								
									d5baeb4690
								
							
						
					
					
						commit
						ac7187eada
					
				|  | @ -48,18 +48,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
|         public DropMethod Drop; | ||||
|         public UUID Id; | ||||
|         public int TimeOutms; | ||||
|         //public EventType Type; | ||||
| 
 | ||||
|         public enum EventType : int | ||||
|         { | ||||
|             Poll = 0, | ||||
|             LslHttp = 1, | ||||
|             Inventory = 2, | ||||
|             Texture = 3, | ||||
|             Mesh = 4, | ||||
|             Mesh2 = 5, | ||||
|             Asset = 6 | ||||
|         } | ||||
| 
 | ||||
|         public string Url { get; set; } | ||||
| 
 | ||||
|  | @ -87,7 +75,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
|             Drop = pDrop; | ||||
|             Id = pId; | ||||
|             TimeOutms = pTimeOutms; | ||||
|             //Type = EventType.Poll; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -177,10 +177,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
| 
 | ||||
|             if(buffer == null) | ||||
|             { | ||||
|                 if (!(contentType.Contains("image") | ||||
|                 if (contentType != null && (!(contentType.Contains("image") | ||||
|                     || contentType.Contains("x-shockwave-flash") | ||||
|                     || contentType.Contains("application/x-oar") | ||||
|                     || contentType.Contains("application/vnd.ll.mesh"))) | ||||
|                     || contentType.Contains("application/vnd.ll.mesh")))) | ||||
|                 { | ||||
|                     // Text | ||||
|                     buffer = Encoding.UTF8.GetBytes(responseString); | ||||
|  |  | |||
|  | @ -50,25 +50,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
| 
 | ||||
|         private bool m_running = false; | ||||
| 
 | ||||
|         //private SmartThreadPool m_threadPool; | ||||
| 
 | ||||
|         public PollServiceRequestManager( | ||||
|             bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) | ||||
|         { | ||||
|             m_WorkerThreadCount = pWorkerThreadCount; | ||||
|             m_workerThreads = new Thread[m_WorkerThreadCount]; | ||||
| 
 | ||||
|             /* | ||||
|             STPStartInfo startInfo = new STPStartInfo(); | ||||
|             startInfo.IdleTimeout = 30000; | ||||
|             startInfo.MaxWorkerThreads = 20; | ||||
|             startInfo.MinWorkerThreads = 1; | ||||
|             startInfo.ThreadPriority = ThreadPriority.Normal; | ||||
|             startInfo.StartSuspended = true; | ||||
|             startInfo.ThreadPoolName = "PoolService"; | ||||
| 
 | ||||
|             m_threadPool = new SmartThreadPool(startInfo); | ||||
|             */ | ||||
|         } | ||||
| 
 | ||||
|         public void Start() | ||||
|  | @ -76,7 +62,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
|             if(m_running) | ||||
|                 return; | ||||
|             m_running = true; | ||||
|             //m_threadPool.Start(); | ||||
|             //startup worker threads | ||||
|             for (uint i = 0; i < m_WorkerThreadCount; i++) | ||||
|             { | ||||
|  | @ -137,10 +122,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
|             foreach (Thread t in m_workerThreads) | ||||
|                 Watchdog.AbortThread(t.ManagedThreadId); | ||||
| 
 | ||||
|             //m_threadPool.Shutdown(); | ||||
| 
 | ||||
|             // any entry in m_bycontext should have a active request on the other queues | ||||
|             // so just delete contents to easy GC | ||||
|             PollServiceHttpRequest req; | ||||
|             try | ||||
|             { | ||||
|  | @ -199,40 +180,22 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
| 
 | ||||
|                     if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | ||||
|                     { | ||||
|                         PollServiceHttpRequest nreq = req; | ||||
|                         //m_threadPool.QueueWorkItem(x => | ||||
|                         //{ | ||||
|                             try | ||||
|                             { | ||||
|                                 Hashtable responsedata = nreq.PollServiceArgs.GetEvents(nreq.RequestID, nreq.PollServiceArgs.Id); | ||||
|                                 nreq.DoHTTPGruntWork(responsedata); | ||||
|                             } | ||||
|                             catch (ObjectDisposedException) { } | ||||
|                             finally | ||||
|                             { | ||||
|                                 nreq = null; | ||||
|                             } | ||||
|                             //return null; | ||||
|                         //}, null); | ||||
|                         try | ||||
|                         { | ||||
|                             Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); | ||||
|                             req.DoHTTPGruntWork(responsedata); | ||||
|                         } | ||||
|                         catch (ObjectDisposedException) { } | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | ||||
|                         { | ||||
|                             PollServiceHttpRequest nreq = req; | ||||
|                             //m_threadPool.QueueWorkItem(x => | ||||
|                             //{ | ||||
|                                 try | ||||
|                                 { | ||||
|                                     nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); | ||||
|                                 } | ||||
|                                 catch (ObjectDisposedException) { } | ||||
|                                 finally | ||||
|                                 { | ||||
|                                     nreq = null; | ||||
|                                 } | ||||
|                                 //return null; | ||||
|                             //}, null); | ||||
|                             try | ||||
|                             { | ||||
|                                 req.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||||
|                             } | ||||
|                             catch (ObjectDisposedException) { } | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
|         private Commands m_commands = new Commands(); | ||||
|         public ICommands Commands { get { return m_commands; } } | ||||
| 
 | ||||
|         ConcurrentDictionary<UUID,OnOutputDelegate> currentConsoles = new ConcurrentDictionary<UUID, OnOutputDelegate>(); | ||||
|         ConcurrentDictionary<UUID, OnOutputDelegate> currentConsoles = new ConcurrentDictionary<UUID, OnOutputDelegate>(); | ||||
| 
 | ||||
|         public event ConsoleMessage OnConsoleMessage; | ||||
| 
 | ||||
|  | @ -101,7 +101,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
|         { | ||||
|             //if (!m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(agentID) && !m_scene.Permissions.IsGod(agentID)) | ||||
|             //    return; | ||||
|             //m_log.DebugFormat("[REGION CONSOLE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||||
|             caps.RegisterSimpleHandler("SimConsoleAsync", | ||||
|                     new ConsoleHandler("/" + UUID.Random(), "SimConsoleAsync", agentID, this, m_scene)); | ||||
|         } | ||||
|  | @ -125,14 +124,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
|                 RemoveConsole(agentID); | ||||
|                 return; | ||||
|             } | ||||
|             OSD osd = OSD.FromString(message); | ||||
| 
 | ||||
|             m_eventQueue.Enqueue(EventQueueHelper.BuildEvent("SimConsoleResponse", osd), agentID); | ||||
| 
 | ||||
|             ConsoleMessage handlerConsoleMessage = OnConsoleMessage; | ||||
| 
 | ||||
|             if (handlerConsoleMessage != null) | ||||
|                 handlerConsoleMessage( agentID, message); | ||||
|             m_eventQueue.Enqueue(m_eventQueue.BuildEvent("SimConsoleResponse", OSD.FromString(message)), agentID); | ||||
|             OnConsoleMessage?.Invoke( agentID, message); | ||||
|         } | ||||
| 
 | ||||
|         public bool RunCommand(string command, UUID invokerID) | ||||
|  |  | |||
|  | @ -104,9 +104,6 @@ namespace OpenSim.Services.HypergridService | |||
|                     m_log.ErrorFormat("[HGASSETS]: Failed to load backing service {0}", str); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         #region IAssetService | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 UbitUmarov
						UbitUmarov