aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs143
1 files changed, 85 insertions, 58 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e38394a..a9f5541 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -87,6 +87,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
87 { 87 {
88 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 88 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
89 89
90 public int LlRequestAgentDataCacheTimeoutMs { get; set; }
91
90 protected IScriptEngine m_ScriptEngine; 92 protected IScriptEngine m_ScriptEngine;
91 protected SceneObjectPart m_host; 93 protected SceneObjectPart m_host;
92 94
@@ -160,30 +162,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
160 /// </summary> 162 /// </summary>
161 private void LoadConfig() 163 private void LoadConfig()
162 { 164 {
163 m_ScriptDelayFactor = 165 LlRequestAgentDataCacheTimeoutMs = 20000;
164 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 166
165 m_ScriptDistanceFactor = 167 IConfig seConfig = m_ScriptEngine.Config;
166 m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); 168
167 m_MinTimerInterval = 169 if (seConfig != null)
168 m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); 170 {
169 m_automaticLinkPermission = 171 m_ScriptDelayFactor =
170 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); 172 seConfig.GetFloat("ScriptDelayFactor", m_ScriptDelayFactor);
171 m_notecardLineReadCharsMax = 173 m_ScriptDistanceFactor =
172 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 174 seConfig.GetFloat("ScriptDistanceLimitFactor", m_ScriptDistanceFactor);
175 m_MinTimerInterval =
176 seConfig.GetFloat("MinTimerInterval", m_MinTimerInterval);
177 m_automaticLinkPermission =
178 seConfig.GetBoolean("AutomaticLinkPermission", m_automaticLinkPermission);
179 m_notecardLineReadCharsMax =
180 seConfig.GetInt("NotecardLineReadCharsMax", m_notecardLineReadCharsMax);
181
182 // Rezzing an object with a velocity can create recoil. This feature seems to have been
183 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
184 // it by this factor. May be zero to turn off recoil all together.
185 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor);
186 }
187
173 if (m_notecardLineReadCharsMax > 65535) 188 if (m_notecardLineReadCharsMax > 65535)
174 m_notecardLineReadCharsMax = 65535; 189 m_notecardLineReadCharsMax = 65535;
175 190
176 // load limits for particular subsystems. 191 // load limits for particular subsystems.
177 IConfig SMTPConfig; 192 IConfigSource seConfigSource = m_ScriptEngine.ConfigSource;
178 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
179 // there's an smtp config, so load in the snooze time.
180 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
181 }
182 193
183 // Rezzing an object with a velocity can create recoil. This feature seems to have been 194 if (seConfigSource != null)
184 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales 195 {
185 // it by this factor. May be zero to turn off recoil all together. 196 IConfig smtpConfig = seConfigSource.Configs["SMTP"];
186 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor); 197 if (smtpConfig != null)
198 {
199 // there's an smtp config, so load in the snooze time.
200 EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
201 }
202 }
187 } 203 }
188 204
189 public override Object InitializeLifetimeService() 205 public override Object InitializeLifetimeService()
@@ -4196,60 +4212,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4196 UserAccount account; 4212 UserAccount account;
4197 4213
4198 UserInfoCacheEntry ce; 4214 UserInfoCacheEntry ce;
4199 if (!m_userInfoCache.TryGetValue(uuid, out ce)) 4215
4216 lock (m_userInfoCache)
4200 { 4217 {
4201 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 4218 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4202 if (account == null)
4203 { 4219 {
4204 m_userInfoCache[uuid] = null; // Cache negative 4220 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
4205 return UUID.Zero.ToString(); 4221 if (account == null)
4206 } 4222 {
4207 4223 m_userInfoCache[uuid] = null; // Cache negative
4224 return UUID.Zero.ToString();
4225 }
4208 4226
4209 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4227 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4210 if (pinfos != null && pinfos.Length > 0) 4228 if (pinfos != null && pinfos.Length > 0)
4211 {
4212 foreach (PresenceInfo p in pinfos)
4213 { 4229 {
4214 if (p.RegionID != UUID.Zero) 4230 foreach (PresenceInfo p in pinfos)
4215 { 4231 {
4216 pinfo = p; 4232 if (p.RegionID != UUID.Zero)
4233 {
4234 pinfo = p;
4235 }
4217 } 4236 }
4218 } 4237 }
4219 }
4220 4238
4221 ce = new UserInfoCacheEntry(); 4239 ce = new UserInfoCacheEntry();
4222 ce.time = Util.EnvironmentTickCount(); 4240 ce.time = Util.EnvironmentTickCount();
4223 ce.account = account; 4241 ce.account = account;
4224 ce.pinfo = pinfo; 4242 ce.pinfo = pinfo;
4225 }
4226 else
4227 {
4228 if (ce == null)
4229 return UUID.Zero.ToString();
4230
4231 account = ce.account;
4232 pinfo = ce.pinfo;
4233 }
4234 4243
4235 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 4244 m_userInfoCache[uuid] = ce;
4236 { 4245 }
4237 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4246 else
4238 if (pinfos != null && pinfos.Length > 0)
4239 { 4247 {
4240 foreach (PresenceInfo p in pinfos) 4248 if (ce == null)
4249 return UUID.Zero.ToString();
4250
4251 account = ce.account;
4252
4253 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time)
4254 >= LlRequestAgentDataCacheTimeoutMs)
4241 { 4255 {
4242 if (p.RegionID != UUID.Zero) 4256 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4257 if (pinfos != null && pinfos.Length > 0)
4258 {
4259 foreach (PresenceInfo p in pinfos)
4260 {
4261 if (p.RegionID != UUID.Zero)
4262 {
4263 pinfo = p;
4264 }
4265 }
4266 }
4267 else
4243 { 4268 {
4244 pinfo = p; 4269 pinfo = null;
4245 } 4270 }
4271
4272 ce.time = Util.EnvironmentTickCount();
4273 ce.pinfo = pinfo;
4274 }
4275 else
4276 {
4277 pinfo = ce.pinfo;
4246 } 4278 }
4247 } 4279 }
4248 else
4249 pinfo = null;
4250
4251 ce.time = Util.EnvironmentTickCount();
4252 ce.pinfo = pinfo;
4253 } 4280 }
4254 4281
4255 string reply = String.Empty; 4282 string reply = String.Empty;