From ad2310656299467c775738fcdbc5840bd492df8d Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:18 -0500 Subject: Second Life viewer sources 1.18.5.2-RC --- linden/indra/newview/llviewermessage.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'linden/indra/newview/llviewermessage.cpp') diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index bd959b9..c337044 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp @@ -131,6 +131,7 @@ #include "pipeline.h" #include "viewer.h" #include "llfloaterworldmap.h" +#include "llkeythrottle.h" #include @@ -144,6 +145,12 @@ const F32 BIRD_AUDIBLE_RADIUS = 32.0f; const F32 SIT_DISTANCE_FROM_TARGET = 0.25f; static const F32 LOGOUT_REPLY_TIME = 3.f; // Wait this long after LogoutReply before quitting. + +// Determine how quickly residents' scripts can issue question dialogs +// Allow bursts of up to 5 dialogs in 10 seconds. 10*2=20 seconds recovery if throttle kicks in +static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests +static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds + extern BOOL gDebugClicks; extern void bad_network_handler(); @@ -4448,6 +4455,27 @@ void process_script_question(LLMessageSystem *msg, void **user_data) // don't display permission requests if this object is muted - JS. if (gMuteListp->isMuted(taskid)) return; + // throttle excessive requests from any specific user's scripts + LLString throttle_owner_name = owner_name; + typedef LLKeyThrottle LLStringThrottle; + static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); + + switch (question_throttle.noteAction(throttle_owner_name)) + { + case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: + llinfos << "process_script_question throttled" + << " owner_name:" << owner_name + << llendl; + // Fall through + + case LLStringThrottle::THROTTLE_BLOCKED: + // Escape altogether until we recover + return; + + case LLStringThrottle::THROTTLE_OK: + break; + } + LLString script_question; if (questions) { -- cgit v1.1