diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/IRegionCommsListener.cs | 68 | ||||
-rw-r--r-- | OpenSim/Framework/RegionCommsListener.cs | 204 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Watchdog.cs | 15 |
5 files changed, 35 insertions, 276 deletions
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs deleted file mode 100644 index cd59c63..0000000 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ /dev/null | |||
@@ -1,68 +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 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | ||
30 | |||
31 | namespace OpenSim.Framework | ||
32 | { | ||
33 | public delegate void ExpectUserDelegate(AgentCircuitData agent); | ||
34 | |||
35 | |||
36 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); | ||
37 | |||
38 | public delegate void AgentCrossing(UUID agentID, Vector3 position, bool isFlying); | ||
39 | |||
40 | public delegate void PrimCrossing(UUID primID, Vector3 position, bool isPhysical); | ||
41 | |||
42 | public delegate void AcknowledgeAgentCross(UUID agentID); | ||
43 | |||
44 | public delegate void AcknowledgePrimCross(UUID PrimID); | ||
45 | |||
46 | public delegate bool CloseAgentConnection(UUID agentID); | ||
47 | |||
48 | public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData); | ||
49 | |||
50 | public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message); | ||
51 | |||
52 | public delegate LandData GetLandData(uint x, uint y); | ||
53 | |||
54 | public interface IRegionCommsListener | ||
55 | { | ||
56 | event ExpectUserDelegate OnExpectUser; | ||
57 | event GenericCall2 OnExpectChildAgent; | ||
58 | event AgentCrossing OnAvatarCrossingIntoRegion; | ||
59 | event PrimCrossing OnPrimCrossingIntoRegion; | ||
60 | event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; | ||
61 | event AcknowledgePrimCross OnAcknowledgePrimCrossed; | ||
62 | event UpdateNeighbours OnNeighboursUpdate; | ||
63 | event CloseAgentConnection OnCloseAgentConnection; | ||
64 | event ChildAgentUpdate OnChildAgentUpdate; | ||
65 | event LogOffUser OnLogOffUser; | ||
66 | event GetLandData OnGetLandData; | ||
67 | } | ||
68 | } | ||
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs deleted file mode 100644 index 3e0955d..0000000 --- a/OpenSim/Framework/RegionCommsListener.cs +++ /dev/null | |||
@@ -1,204 +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 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Framework | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// Sandbox mode region comms listener. There is one of these per region | ||
36 | /// </summary> | ||
37 | public class RegionCommsListener : IRegionCommsListener | ||
38 | { | ||
39 | public string debugRegionName = String.Empty; | ||
40 | private AcknowledgeAgentCross handlerAcknowledgeAgentCrossed = null; // OnAcknowledgeAgentCrossed; | ||
41 | private AcknowledgePrimCross handlerAcknowledgePrimCrossed = null; // OnAcknowledgePrimCrossed; | ||
42 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; | ||
43 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | ||
44 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; | ||
45 | private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; | ||
46 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser | ||
47 | private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; | ||
48 | // private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; | ||
49 | private LogOffUser handlerLogOffUser = null; | ||
50 | private GetLandData handlerGetLandData = null; | ||
51 | |||
52 | #region IRegionCommsListener Members | ||
53 | |||
54 | public event ExpectUserDelegate OnExpectUser; | ||
55 | public event GenericCall2 OnExpectChildAgent; | ||
56 | public event AgentCrossing OnAvatarCrossingIntoRegion; | ||
57 | public event PrimCrossing OnPrimCrossingIntoRegion; | ||
58 | public event UpdateNeighbours OnNeighboursUpdate; | ||
59 | public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; | ||
60 | public event AcknowledgePrimCross OnAcknowledgePrimCrossed; | ||
61 | public event CloseAgentConnection OnCloseAgentConnection; | ||
62 | public event ChildAgentUpdate OnChildAgentUpdate; | ||
63 | public event LogOffUser OnLogOffUser; | ||
64 | public event GetLandData OnGetLandData; | ||
65 | |||
66 | #endregion | ||
67 | |||
68 | /// <summary> | ||
69 | /// | ||
70 | /// </summary> | ||
71 | /// <param name="agent"></param> | ||
72 | /// <returns></returns> | ||
73 | public virtual bool TriggerExpectUser(AgentCircuitData agent) | ||
74 | { | ||
75 | handlerExpectUser = OnExpectUser; | ||
76 | if (handlerExpectUser != null) | ||
77 | { | ||
78 | handlerExpectUser(agent); | ||
79 | return true; | ||
80 | } | ||
81 | |||
82 | return false; | ||
83 | } | ||
84 | |||
85 | // From User Server | ||
86 | public virtual void TriggerLogOffUser(UUID agentID, UUID RegionSecret, string message) | ||
87 | { | ||
88 | handlerLogOffUser = OnLogOffUser; | ||
89 | if (handlerLogOffUser != null) | ||
90 | { | ||
91 | handlerLogOffUser(agentID, RegionSecret, message); | ||
92 | } | ||
93 | |||
94 | } | ||
95 | |||
96 | public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) | ||
97 | { | ||
98 | handlerChildAgentUpdate = OnChildAgentUpdate; | ||
99 | if (handlerChildAgentUpdate != null) | ||
100 | { | ||
101 | handlerChildAgentUpdate(cAgentData); | ||
102 | return true; | ||
103 | } | ||
104 | return false; | ||
105 | } | ||
106 | |||
107 | public virtual bool TriggerExpectAvatarCrossing(UUID agentID, Vector3 position, bool isFlying) | ||
108 | { | ||
109 | handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; | ||
110 | if (handlerAvatarCrossingIntoRegion != null) | ||
111 | { | ||
112 | handlerAvatarCrossingIntoRegion(agentID, position, isFlying); | ||
113 | return true; | ||
114 | } | ||
115 | return false; | ||
116 | } | ||
117 | |||
118 | public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) | ||
119 | { | ||
120 | handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; | ||
121 | if (handlerAcknowledgeAgentCrossed != null) | ||
122 | { | ||
123 | handlerAcknowledgeAgentCrossed(agentID); | ||
124 | return true; | ||
125 | } | ||
126 | return false; | ||
127 | } | ||
128 | |||
129 | public virtual bool TriggerAcknowledgePrimCrossed(UUID primID) | ||
130 | { | ||
131 | handlerAcknowledgePrimCrossed = OnAcknowledgePrimCrossed; | ||
132 | if (handlerAcknowledgePrimCrossed != null) | ||
133 | { | ||
134 | handlerAcknowledgePrimCrossed(primID); | ||
135 | return true; | ||
136 | } | ||
137 | return false; | ||
138 | } | ||
139 | |||
140 | public virtual bool TriggerCloseAgentConnection(UUID agentID) | ||
141 | { | ||
142 | handlerCloseAgentConnection = OnCloseAgentConnection; | ||
143 | if (handlerCloseAgentConnection != null) | ||
144 | { | ||
145 | handlerCloseAgentConnection(agentID); | ||
146 | return true; | ||
147 | } | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// | ||
153 | /// </summary> | ||
154 | /// <remarks>TODO: Doesnt take any args??</remarks> | ||
155 | /// <returns></returns> | ||
156 | public virtual bool TriggerExpectChildAgent() | ||
157 | { | ||
158 | handlerExpectChildAgent = OnExpectChildAgent; | ||
159 | if (handlerExpectChildAgent != null) | ||
160 | { | ||
161 | handlerExpectChildAgent(); | ||
162 | return true; | ||
163 | } | ||
164 | |||
165 | return false; | ||
166 | } | ||
167 | |||
168 | /// <summary> | ||
169 | /// | ||
170 | /// </summary> | ||
171 | /// <remarks>Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me</remarks> | ||
172 | /// <param name="neighbours"></param> | ||
173 | /// <returns></returns> | ||
174 | public virtual bool TriggerOnNeighboursUpdate(List<RegionInfo> neighbours) | ||
175 | { | ||
176 | handlerNeighboursUpdate = OnNeighboursUpdate; | ||
177 | if (handlerNeighboursUpdate != null) | ||
178 | { | ||
179 | handlerNeighboursUpdate(neighbours); | ||
180 | return true; | ||
181 | } | ||
182 | |||
183 | return false; | ||
184 | } | ||
185 | |||
186 | public bool TriggerTellRegionToCloseChildConnection(UUID agentID) | ||
187 | { | ||
188 | handlerCloseAgentConnection = OnCloseAgentConnection; | ||
189 | if (handlerCloseAgentConnection != null) | ||
190 | return handlerCloseAgentConnection(agentID); | ||
191 | |||
192 | return false; | ||
193 | } | ||
194 | |||
195 | public LandData TriggerGetLandData(uint x, uint y) | ||
196 | { | ||
197 | handlerGetLandData = OnGetLandData; | ||
198 | if (handlerGetLandData != null) | ||
199 | return handlerGetLandData(x, y); | ||
200 | |||
201 | return null; | ||
202 | } | ||
203 | } | ||
204 | } | ||
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 66d0813..3551d5d 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -243,17 +243,32 @@ namespace OpenSim.Framework.Servers | |||
243 | /// </summary> | 243 | /// </summary> |
244 | protected string GetThreadsReport() | 244 | protected string GetThreadsReport() |
245 | { | 245 | { |
246 | // This should be a constant field. | ||
247 | string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; | ||
248 | |||
246 | StringBuilder sb = new StringBuilder(); | 249 | StringBuilder sb = new StringBuilder(); |
247 | Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); | 250 | Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); |
248 | 251 | ||
249 | sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); | 252 | sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); |
253 | |||
254 | int timeNow = Util.EnvironmentTickCount(); | ||
255 | |||
256 | sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE"); | ||
257 | sb.Append(Environment.NewLine); | ||
258 | |||
250 | foreach (Watchdog.ThreadWatchdogInfo twi in threads) | 259 | foreach (Watchdog.ThreadWatchdogInfo twi in threads) |
251 | { | 260 | { |
252 | Thread t = twi.Thread; | 261 | Thread t = twi.Thread; |
253 | 262 | ||
254 | sb.Append( | 263 | sb.AppendFormat( |
255 | "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: " | 264 | reportFormat, |
256 | + "Pri: " + t.Priority + ", State: " + t.ThreadState); | 265 | t.ManagedThreadId, |
266 | t.Name, | ||
267 | timeNow - twi.LastTick, | ||
268 | timeNow - twi.FirstTick, | ||
269 | t.Priority, | ||
270 | t.ThreadState); | ||
271 | |||
257 | sb.Append(Environment.NewLine); | 272 | sb.Append(Environment.NewLine); |
258 | } | 273 | } |
259 | 274 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 16e56d2..5e171f0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -69,6 +69,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
69 | while (m_running) | 69 | while (m_running) |
70 | { | 70 | { |
71 | PollServiceHttpRequest req = m_request.Dequeue(); | 71 | PollServiceHttpRequest req = m_request.Dequeue(); |
72 | |||
73 | Watchdog.UpdateThread(); | ||
74 | |||
72 | try | 75 | try |
73 | { | 76 | { |
74 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | 77 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 4847675..fa94109 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs | |||
@@ -48,6 +48,18 @@ namespace OpenSim.Framework | |||
48 | public class ThreadWatchdogInfo | 48 | public class ThreadWatchdogInfo |
49 | { | 49 | { |
50 | public Thread Thread { get; private set; } | 50 | public Thread Thread { get; private set; } |
51 | |||
52 | /// <summary> | ||
53 | /// Approximate tick when this thread was started. | ||
54 | /// </summary> | ||
55 | /// <remarks> | ||
56 | /// Not terribly good since this quickly wraps around. | ||
57 | /// </remarks> | ||
58 | public int FirstTick { get; private set; } | ||
59 | |||
60 | /// <summary> | ||
61 | /// First time this heartbeat update was invoked | ||
62 | /// </summary> | ||
51 | public int LastTick { get; set; } | 63 | public int LastTick { get; set; } |
52 | 64 | ||
53 | /// <summary> | 65 | /// <summary> |
@@ -64,7 +76,8 @@ namespace OpenSim.Framework | |||
64 | { | 76 | { |
65 | Thread = thread; | 77 | Thread = thread; |
66 | Timeout = timeout; | 78 | Timeout = timeout; |
67 | LastTick = Environment.TickCount & Int32.MaxValue; | 79 | FirstTick = Environment.TickCount & Int32.MaxValue; |
80 | LastTick = FirstTick; | ||
68 | } | 81 | } |
69 | } | 82 | } |
70 | 83 | ||