diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 2000279..b16076d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -53,6 +53,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] | 53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetTextureModule")] |
54 | public class GetTextureModule : INonSharedRegionModule | 54 | public class GetTextureModule : INonSharedRegionModule |
55 | { | 55 | { |
56 | |||
57 | struct aPollRequest | ||
58 | { | ||
59 | public PollServiceTextureEventArgs thepoll; | ||
60 | public UUID reqID; | ||
61 | public Hashtable request; | ||
62 | } | ||
63 | |||
56 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 64 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 65 | ||
58 | private Scene m_scene; | 66 | private Scene m_scene; |
@@ -64,8 +72,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
64 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); | 72 | private Dictionary<UUID, string> m_capsDict = new Dictionary<UUID, string>(); |
65 | private static Thread[] m_workerThreads = null; | 73 | private static Thread[] m_workerThreads = null; |
66 | 74 | ||
67 | private static OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs> m_queue = | 75 | private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = |
68 | new OpenMetaverse.BlockingQueue<PollServiceTextureEventArgs>(); | 76 | new OpenMetaverse.BlockingQueue<aPollRequest>(); |
69 | 77 | ||
70 | #region ISharedRegionModule Members | 78 | #region ISharedRegionModule Members |
71 | 79 | ||
@@ -104,7 +112,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
104 | String.Format("TextureWorkerThread{0}", i), | 112 | String.Format("TextureWorkerThread{0}", i), |
105 | ThreadPriority.Normal, | 113 | ThreadPriority.Normal, |
106 | false, | 114 | false, |
107 | true, | 115 | false, |
108 | null, | 116 | null, |
109 | int.MaxValue); | 117 | int.MaxValue); |
110 | } | 118 | } |
@@ -129,7 +137,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
129 | ~GetTextureModule() | 137 | ~GetTextureModule() |
130 | { | 138 | { |
131 | foreach (Thread t in m_workerThreads) | 139 | foreach (Thread t in m_workerThreads) |
132 | t.Abort(); | 140 | Watchdog.AbortThread(t.ManagedThreadId); |
141 | |||
133 | } | 142 | } |
134 | 143 | ||
135 | private class PollServiceTextureEventArgs : PollServiceEventArgs | 144 | private class PollServiceTextureEventArgs : PollServiceEventArgs |
@@ -142,7 +151,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
142 | private Scene m_scene; | 151 | private Scene m_scene; |
143 | 152 | ||
144 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : | 153 | public PollServiceTextureEventArgs(UUID pId, Scene scene) : |
145 | base(null, null, null, null, pId, 30000) | 154 | base(null, null, null, null, pId, int.MaxValue) |
155 | // this should never timeout | ||
156 | // each request must be processed and return a response | ||
157 | // noevents can possible be use for nice shutdown, but not sure now | ||
158 | // the execution will provide a proper response even if it fails | ||
159 | |||
146 | { | 160 | { |
147 | m_scene = scene; | 161 | m_scene = scene; |
148 | 162 | ||
@@ -164,21 +178,24 @@ namespace OpenSim.Region.ClientStack.Linden | |||
164 | 178 | ||
165 | Request = (x, y) => | 179 | Request = (x, y) => |
166 | { | 180 | { |
167 | y["RequestID"] = x.ToString(); | 181 | aPollRequest reqinfo = new aPollRequest(); |
168 | lock (requests) | 182 | reqinfo.thepoll = this; |
169 | requests.Add(y); | 183 | reqinfo.reqID = x; |
184 | reqinfo.request = y; | ||
170 | 185 | ||
171 | m_queue.Enqueue(this); | 186 | m_queue.Enqueue(reqinfo); |
172 | }; | 187 | }; |
173 | 188 | ||
189 | // this should never happen except possible on shutdown | ||
174 | NoEvents = (x, y) => | 190 | NoEvents = (x, y) => |
175 | { | 191 | { |
192 | /* | ||
176 | lock (requests) | 193 | lock (requests) |
177 | { | 194 | { |
178 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); | 195 | Hashtable request = requests.Find(id => id["RequestID"].ToString() == x.ToString()); |
179 | requests.Remove(request); | 196 | requests.Remove(request); |
180 | } | 197 | } |
181 | 198 | */ | |
182 | Hashtable response = new Hashtable(); | 199 | Hashtable response = new Hashtable(); |
183 | 200 | ||
184 | response["int_response_code"] = 500; | 201 | response["int_response_code"] = 500; |
@@ -191,27 +208,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
191 | }; | 208 | }; |
192 | } | 209 | } |
193 | 210 | ||
194 | public void Process() | 211 | public void Process(aPollRequest requestinfo) |
195 | { | 212 | { |
196 | Hashtable response; | 213 | Hashtable response; |
197 | Hashtable request = null; | ||
198 | 214 | ||
199 | try | 215 | UUID requestID = requestinfo.reqID; |
200 | { | ||
201 | lock (requests) | ||
202 | { | ||
203 | request = requests[0]; | ||
204 | requests.RemoveAt(0); | ||
205 | } | ||
206 | } | ||
207 | catch | ||
208 | { | ||
209 | return; | ||
210 | } | ||
211 | |||
212 | UUID requestID = new UUID(request["RequestID"].ToString()); | ||
213 | 216 | ||
214 | // If the avatar is gone, don't bother to get the texture | 217 | // If the avatar is gone, don't bother to get the texture |
218 | |||
215 | if (m_scene.GetScenePresence(Id) == null) | 219 | if (m_scene.GetScenePresence(Id) == null) |
216 | { | 220 | { |
217 | response = new Hashtable(); | 221 | response = new Hashtable(); |
@@ -228,7 +232,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
228 | return; | 232 | return; |
229 | } | 233 | } |
230 | 234 | ||
231 | response = m_getTextureHandler.Handle(request); | 235 | response = m_getTextureHandler.Handle(requestinfo.request); |
232 | lock (responses) | 236 | lock (responses) |
233 | responses[requestID] = response; | 237 | responses[requestID] = response; |
234 | } | 238 | } |
@@ -275,11 +279,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
275 | { | 279 | { |
276 | while (true) | 280 | while (true) |
277 | { | 281 | { |
278 | PollServiceTextureEventArgs args = m_queue.Dequeue(); | 282 | aPollRequest poolreq = m_queue.Dequeue(); |
279 | 283 | ||
280 | args.Process(); | 284 | poolreq.thepoll.Process(poolreq); |
281 | } | 285 | } |
282 | } | 286 | } |
283 | } | 287 | } |
284 | |||
285 | } | 288 | } |