diff options
author | UbitUmarov | 2012-07-11 09:03:18 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-11 09:03:18 +0100 |
commit | 6252114ea02c07bab2b61fa882f4a26264cbb347 (patch) | |
tree | 86821d2ba17eb79b676453dbdfe575e5459314c3 /OpenSim | |
parent | ubitODE leaks (diff) | |
download | opensim-SC-6252114ea02c07bab2b61fa882f4a26264cbb347.zip opensim-SC-6252114ea02c07bab2b61fa882f4a26264cbb347.tar.gz opensim-SC-6252114ea02c07bab2b61fa882f4a26264cbb347.tar.bz2 opensim-SC-6252114ea02c07bab2b61fa882f4a26264cbb347.tar.xz |
remove expensive and leaked ( in Xengine at least) SayShout timer and
replace it by a simpler function that should do the same (?) (don't like
much those 10 + 1 bursts)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 05bb161..ca62bac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -108,8 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
108 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | 108 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = |
109 | new Dictionary<UUID, UserInfoCacheEntry>(); | 109 | new Dictionary<UUID, UserInfoCacheEntry>(); |
110 | 110 | ||
111 | protected Timer m_ShoutSayTimer; | 111 | // protected Timer m_ShoutSayTimer; |
112 | protected int m_SayShoutCount = 0; | 112 | protected int m_SayShoutCount = 0; |
113 | DateTime m_lastSayShoutCheck; | ||
113 | 114 | ||
114 | private Dictionary<string, string> MovementAnimationsForLSL = | 115 | private Dictionary<string, string> MovementAnimationsForLSL = |
115 | new Dictionary<string, string> { | 116 | new Dictionary<string, string> { |
@@ -135,10 +136,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
135 | 136 | ||
136 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 137 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
137 | { | 138 | { |
139 | /* | ||
138 | m_ShoutSayTimer = new Timer(1000); | 140 | m_ShoutSayTimer = new Timer(1000); |
139 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; | 141 | m_ShoutSayTimer.Elapsed += SayShoutTimerElapsed; |
140 | m_ShoutSayTimer.AutoReset = true; | 142 | m_ShoutSayTimer.AutoReset = true; |
141 | m_ShoutSayTimer.Start(); | 143 | m_ShoutSayTimer.Start(); |
144 | */ | ||
145 | m_lastSayShoutCheck = DateTime.UtcNow; | ||
142 | 146 | ||
143 | m_ScriptEngine = ScriptEngine; | 147 | m_ScriptEngine = ScriptEngine; |
144 | m_host = host; | 148 | m_host = host; |
@@ -900,12 +904,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
900 | wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); | 904 | wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); |
901 | } | 905 | } |
902 | 906 | ||
907 | private void CheckSayShoutTime() | ||
908 | { | ||
909 | DateTime now = DateTime.UtcNow; | ||
910 | if ((now - m_lastSayShoutCheck).Ticks > 10000000) // 1sec | ||
911 | { | ||
912 | m_lastSayShoutCheck = now; | ||
913 | m_SayShoutCount = 0; | ||
914 | } | ||
915 | else | ||
916 | m_SayShoutCount++; | ||
917 | } | ||
918 | |||
903 | public void llSay(int channelID, string text) | 919 | public void llSay(int channelID, string text) |
904 | { | 920 | { |
905 | m_host.AddScriptLPS(1); | 921 | m_host.AddScriptLPS(1); |
906 | 922 | ||
907 | if (channelID == 0) | 923 | if (channelID == 0) |
908 | m_SayShoutCount++; | 924 | // m_SayShoutCount++; |
925 | CheckSayShoutTime(); | ||
909 | 926 | ||
910 | if (m_SayShoutCount >= 11) | 927 | if (m_SayShoutCount >= 11) |
911 | ScriptSleep(2000); | 928 | ScriptSleep(2000); |
@@ -933,7 +950,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
933 | m_host.AddScriptLPS(1); | 950 | m_host.AddScriptLPS(1); |
934 | 951 | ||
935 | if (channelID == 0) | 952 | if (channelID == 0) |
936 | m_SayShoutCount++; | 953 | // m_SayShoutCount++; |
954 | CheckSayShoutTime(); | ||
937 | 955 | ||
938 | if (m_SayShoutCount >= 11) | 956 | if (m_SayShoutCount >= 11) |
939 | ScriptSleep(2000); | 957 | ScriptSleep(2000); |
@@ -12373,12 +12391,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12373 | 12391 | ||
12374 | return rq.ToString(); | 12392 | return rq.ToString(); |
12375 | } | 12393 | } |
12376 | 12394 | /* | |
12377 | private void SayShoutTimerElapsed(Object sender, ElapsedEventArgs args) | 12395 | private void SayShoutTimerElapsed(Object sender, ElapsedEventArgs args) |
12378 | { | 12396 | { |
12379 | m_SayShoutCount = 0; | 12397 | m_SayShoutCount = 0; |
12380 | } | 12398 | } |
12381 | 12399 | */ | |
12382 | private struct Tri | 12400 | private struct Tri |
12383 | { | 12401 | { |
12384 | public Vector3 p1; | 12402 | public Vector3 p1; |