diff options
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rw-r--r-- | linden/indra/newview/llviewermessage.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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 @@ | |||
131 | #include "pipeline.h" | 131 | #include "pipeline.h" |
132 | #include "viewer.h" | 132 | #include "viewer.h" |
133 | #include "llfloaterworldmap.h" | 133 | #include "llfloaterworldmap.h" |
134 | #include "llkeythrottle.h" | ||
134 | 135 | ||
135 | #include <boost/tokenizer.hpp> | 136 | #include <boost/tokenizer.hpp> |
136 | 137 | ||
@@ -144,6 +145,12 @@ | |||
144 | const F32 BIRD_AUDIBLE_RADIUS = 32.0f; | 145 | const F32 BIRD_AUDIBLE_RADIUS = 32.0f; |
145 | const F32 SIT_DISTANCE_FROM_TARGET = 0.25f; | 146 | const F32 SIT_DISTANCE_FROM_TARGET = 0.25f; |
146 | static const F32 LOGOUT_REPLY_TIME = 3.f; // Wait this long after LogoutReply before quitting. | 147 | static const F32 LOGOUT_REPLY_TIME = 3.f; // Wait this long after LogoutReply before quitting. |
148 | |||
149 | // Determine how quickly residents' scripts can issue question dialogs | ||
150 | // Allow bursts of up to 5 dialogs in 10 seconds. 10*2=20 seconds recovery if throttle kicks in | ||
151 | static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests | ||
152 | static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds | ||
153 | |||
147 | extern BOOL gDebugClicks; | 154 | extern BOOL gDebugClicks; |
148 | 155 | ||
149 | extern void bad_network_handler(); | 156 | extern void bad_network_handler(); |
@@ -4448,6 +4455,27 @@ void process_script_question(LLMessageSystem *msg, void **user_data) | |||
4448 | // don't display permission requests if this object is muted - JS. | 4455 | // don't display permission requests if this object is muted - JS. |
4449 | if (gMuteListp->isMuted(taskid)) return; | 4456 | if (gMuteListp->isMuted(taskid)) return; |
4450 | 4457 | ||
4458 | // throttle excessive requests from any specific user's scripts | ||
4459 | LLString throttle_owner_name = owner_name; | ||
4460 | typedef LLKeyThrottle<LLString> LLStringThrottle; | ||
4461 | static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); | ||
4462 | |||
4463 | switch (question_throttle.noteAction(throttle_owner_name)) | ||
4464 | { | ||
4465 | case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: | ||
4466 | llinfos << "process_script_question throttled" | ||
4467 | << " owner_name:" << owner_name | ||
4468 | << llendl; | ||
4469 | // Fall through | ||
4470 | |||
4471 | case LLStringThrottle::THROTTLE_BLOCKED: | ||
4472 | // Escape altogether until we recover | ||
4473 | return; | ||
4474 | |||
4475 | case LLStringThrottle::THROTTLE_OK: | ||
4476 | break; | ||
4477 | } | ||
4478 | |||
4451 | LLString script_question; | 4479 | LLString script_question; |
4452 | if (questions) | 4480 | if (questions) |
4453 | { | 4481 | { |