aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2013-06-11 21:03:02 +0100
committerMelanie2013-06-11 21:03:02 +0100
commit162dfd8a381999cf5883f4886b9b9aee3a3ad149 (patch)
treec1c20d043ede7be76e7131218585336ad9df0219 /OpenSim
parentMerge branch 'master' into careminster (diff)
parentPut the "script saved" and "notecard saved" messages back into the bottom (diff)
downloadopensim-SC-162dfd8a381999cf5883f4886b9b9aee3a3ad149.zip
opensim-SC-162dfd8a381999cf5883f4886b9b9aee3a3ad149.tar.gz
opensim-SC-162dfd8a381999cf5883f4886b9b9aee3a3ad149.tar.bz2
opensim-SC-162dfd8a381999cf5883f4886b9b9aee3a3ad149.tar.xz
Merge branch 'avination-current' into careminster
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs144
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs175
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs23
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs4
5 files changed, 16 insertions, 332 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index c2254c4..98789be 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -34,143 +34,6 @@ using HttpServer;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring; 35using OpenSim.Framework.Monitoring;
36using Amib.Threading; 36using Amib.Threading;
37
38
39/*
40namespace OpenSim.Framework.Servers.HttpServer
41{
42
43 public class PollServiceRequestManager
44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 private readonly BaseHttpServer m_server;
48 private static Queue m_requests = Queue.Synchronized(new Queue());
49 private static ManualResetEvent m_ev = new ManualResetEvent(false);
50 private uint m_WorkerThreadCount = 0;
51 private Thread[] m_workerThreads;
52 private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
53 private volatile bool m_running = true;
54 private int m_pollTimeout;
55
56 public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
57 {
58 m_server = pSrv;
59 m_WorkerThreadCount = pWorkerThreadCount;
60 m_pollTimeout = pTimeout;
61 }
62
63 public void Start()
64 {
65 m_running = true;
66 m_workerThreads = new Thread[m_WorkerThreadCount];
67 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
68
69 //startup worker threads
70 for (uint i = 0; i < m_WorkerThreadCount; i++)
71 {
72 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout);
73 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
74
75 m_workerThreads[i]
76 = Watchdog.StartThread(
77 m_PollServiceWorkerThreads[i].ThreadStart,
78 String.Format("PollServiceWorkerThread{0}", i),
79 ThreadPriority.Normal,
80 false,
81 true,
82 int.MaxValue);
83 }
84
85 Watchdog.StartThread(
86 this.ThreadStart,
87 "PollServiceWatcherThread",
88 ThreadPriority.Normal,
89 false,
90 true,
91 1000 * 60 * 10);
92 }
93
94 internal void ReQueueEvent(PollServiceHttpRequest req)
95 {
96 // Do accounting stuff here
97 Enqueue(req);
98 }
99
100 public void Enqueue(PollServiceHttpRequest req)
101 {
102 lock (m_requests)
103 m_requests.Enqueue(req);
104 m_ev.Set();
105 }
106
107 public void ThreadStart()
108 {
109 while (m_running)
110 {
111 m_ev.WaitOne(1000);
112 m_ev.Reset();
113 Watchdog.UpdateThread();
114 ProcessQueuedRequests();
115 }
116 }
117
118 private void ProcessQueuedRequests()
119 {
120 lock (m_requests)
121 {
122 if (m_requests.Count == 0)
123 return;
124
125// m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count);
126
127 int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1;
128
129 // For Each WorkerThread
130 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
131 {
132 //Loop over number of requests each thread handles.
133 for (int i = 0; i < reqperthread && m_requests.Count > 0; i++)
134 {
135 try
136 {
137 m_PollServiceWorkerThreads[tc].Enqueue((PollServiceHttpRequest)m_requests.Dequeue());
138 }
139 catch (InvalidOperationException)
140 {
141 // The queue is empty, we did our calculations wrong!
142 return;
143 }
144
145 }
146 }
147 }
148
149 }
150
151 public void Stop()
152 {
153 m_running = false;
154
155 foreach (object o in m_requests)
156 {
157 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
158 m_server.DoHTTPGruntWork(
159 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
160 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
161 }
162
163 m_requests.Clear();
164
165 foreach (Thread t in m_workerThreads)
166 {
167 t.Abort();
168 }
169 }
170 }
171}
172 */
173
174using System.IO; 37using System.IO;
175using System.Text; 38using System.Text;
176using System.Collections.Generic; 39using System.Collections.Generic;
@@ -196,8 +59,6 @@ namespace OpenSim.Framework.Servers.HttpServer
196 59
197 private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); 60 private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2);
198 61
199// private int m_timeout = 1000; // increase timeout 250; now use the event one
200
201 public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) 62 public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
202 { 63 {
203 m_server = pSrv; 64 m_server = pSrv;
@@ -284,7 +145,6 @@ namespace OpenSim.Framework.Servers.HttpServer
284 public void Stop() 145 public void Stop()
285 { 146 {
286 m_running = false; 147 m_running = false;
287// m_timeout = -10000; // cause all to expire
288 Thread.Sleep(1000); // let the world move 148 Thread.Sleep(1000); // let the world move
289 149
290 foreach (Thread t in m_workerThreads) 150 foreach (Thread t in m_workerThreads)
@@ -420,14 +280,10 @@ namespace OpenSim.Framework.Servers.HttpServer
420 } 280 }
421 finally 281 finally
422 { 282 {
423 //response.OutputStream.Close();
424 try 283 try
425 { 284 {
426 response.OutputStream.Flush(); 285 response.OutputStream.Flush();
427 response.Send(); 286 response.Send();
428
429 //if (!response.KeepAlive && response.ReuseContext)
430 // response.FreeContext();
431 } 287 }
432 catch (Exception e) 288 catch (Exception e)
433 { 289 {
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
deleted file mode 100644
index 1c529b6..0000000
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Ubit work moved to PollServiceRequestManager
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.IO;
34using System.Text;
35using HttpServer;
36using OpenMetaverse;
37using System.Reflection;
38using log4net;
39using OpenSim.Framework.Monitoring;
40
41namespace OpenSim.Framework.Servers.HttpServer
42{
43 public delegate void ReQueuePollServiceItem(PollServiceHttpRequest req);
44
45 public class PollServiceWorkerThread
46 {
47 private static readonly ILog m_log =
48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType);
50
51 public event ReQueuePollServiceItem ReQueue;
52
53 private readonly BaseHttpServer m_server;
54 private BlockingQueue<PollServiceHttpRequest> m_request;
55 private bool m_running = true;
56 private int m_timeout = 250;
57
58 public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout)
59 {
60 m_request = new BlockingQueue<PollServiceHttpRequest>();
61 m_server = pSrv;
62 m_timeout = pTimeout;
63 }
64
65 public void ThreadStart()
66 {
67 Run();
68 }
69
70 public void Run()
71 {
72 while (m_running)
73 {
74 PollServiceHttpRequest req = m_request.Dequeue();
75
76 Watchdog.UpdateThread();
77
78 try
79 {
80 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
81 {
82 StreamReader str;
83 try
84 {
85 str = new StreamReader(req.Request.Body);
86 }
87 catch (System.ArgumentException)
88 {
89 // Stream was not readable means a child agent
90 // was closed due to logout, leaving the
91 // Event Queue request orphaned.
92 continue;
93 }
94
95 try
96 {
97 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
98 DoHTTPGruntWork(m_server, req, responsedata);
99 }
100 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
101 {
102 // Ignore it, no need to reply
103 }
104 }
105 else
106 {
107 if ((Environment.TickCount - req.RequestTime) > m_timeout)
108 {
109 DoHTTPGruntWork(
110 m_server,
111 req,
112 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
113 }
114 else
115 {
116 ReQueuePollServiceItem reQueueItem = ReQueue;
117 if (reQueueItem != null)
118 reQueueItem(req);
119 }
120 }
121 }
122 catch (Exception e)
123 {
124 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
125 }
126 }
127 }
128
129 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest)
130 {
131 m_request.Enqueue(pPollServiceHttpRequest);
132 }
133
134 /// <summary>
135 /// FIXME: This should be part of BaseHttpServer
136 /// </summary>
137 internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata)
138 {
139 OSHttpResponse response
140 = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
141
142 byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
143
144 response.SendChunked = false;
145 response.ContentLength64 = buffer.Length;
146 response.ContentEncoding = Encoding.UTF8;
147
148 try
149 {
150 response.OutputStream.Write(buffer, 0, buffer.Length);
151 }
152 catch (Exception ex)
153 {
154 m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
155 }
156 finally
157 {
158 //response.OutputStream.Close();
159 try
160 {
161 response.OutputStream.Flush();
162 response.Send();
163
164 //if (!response.KeepAlive && response.ReuseContext)
165 // response.FreeContext();
166 }
167 catch (Exception e)
168 {
169 m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
170 }
171 }
172 }
173 }
174}
175*/ \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 59b9585..8241e07 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -990,13 +990,20 @@ namespace OpenSim.Region.ClientStack.Linden
990 else 990 else
991 prim.Name = assetName + "#" + i.ToString(); 991 prim.Name = assetName + "#" + i.ToString();
992 992
993 prim.EveryoneMask = 0;
994 prim.GroupMask = 0;
995
993 if (restrictPerms) 996 if (restrictPerms)
994 { 997 {
995 prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); 998 prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
996 prim.EveryoneMask = 0;
997 prim.GroupMask = 0;
998 prim.NextOwnerMask = 0;
999 prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); 999 prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify);
1000 prim.NextOwnerMask = 0;
1001 }
1002 else
1003 {
1004 prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1005 prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1006 prim.NextOwnerMask = (uint)PermissionMask.Transfer;
1000 } 1007 }
1001 1008
1002 if(istest) 1009 if(istest)
@@ -1099,21 +1106,17 @@ namespace OpenSim.Region.ClientStack.Linden
1099 1106
1100 if (restrictPerms) 1107 if (restrictPerms)
1101 { 1108 {
1102 item.CurrentPermissions
1103 = (uint)(PermissionMask.Move | PermissionMask.Modify);
1104
1105 item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); 1109 item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1110 item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
1106 item.EveryOnePermissions = 0; 1111 item.EveryOnePermissions = 0;
1107 item.NextPermissions = 0; 1112 item.NextPermissions = 0;
1108 } 1113 }
1109 else 1114 else
1110 { 1115 {
1111 item.CurrentPermissions
1112 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
1113
1114 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export; 1116 item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1117 item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
1115 item.EveryOnePermissions = 0; 1118 item.EveryOnePermissions = 0;
1116 item.NextPermissions = (uint)PermissionMask.All; 1119 item.NextPermissions = (uint)PermissionMask.Transfer;
1117 } 1120 }
1118 1121
1119 item.CreationDate = Util.UnixTimeSinceEpoch(); 1122 item.CreationDate = Util.UnixTimeSinceEpoch();
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 0f03ad0..a60b314 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -1147,7 +1147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1147 AttachmentPt &= 0x7f; 1147 AttachmentPt &= 0x7f;
1148 1148
1149 // Calls attach with a Zero position 1149 // Calls attach with a Zero position
1150 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, false, append)) 1150 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, true, append))
1151 { 1151 {
1152 if (DebugLevel > 0) 1152 if (DebugLevel > 0)
1153 m_log.Debug( 1153 m_log.Debug(
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index d5c2661..588da10 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -265,7 +265,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
265 return UUID.Zero; 265 return UUID.Zero;
266 } 266 }
267 267
268 remoteClient.SendAgentAlertMessage("Notecard saved", false); 268 remoteClient.SendAlertMessage("Notecard saved");
269 } 269 }
270 else if ((InventoryType)item.InvType == InventoryType.LSL) 270 else if ((InventoryType)item.InvType == InventoryType.LSL)
271 { 271 {
@@ -275,7 +275,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
275 return UUID.Zero; 275 return UUID.Zero;
276 } 276 }
277 277
278 remoteClient.SendAgentAlertMessage("Script saved", false); 278 remoteClient.SendAlertMessage("Script saved");
279 } 279 }
280 280
281 AssetBase asset = 281 AssetBase asset =