aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llplugin/llpluginprocesschild.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlinden/indra/llplugin/llpluginprocesschild.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/linden/indra/llplugin/llpluginprocesschild.cpp b/linden/indra/llplugin/llpluginprocesschild.cpp
index 8dbf2b3..a1291c0 100755
--- a/linden/indra/llplugin/llpluginprocesschild.cpp
+++ b/linden/indra/llplugin/llpluginprocesschild.cpp
@@ -47,7 +47,7 @@ LLPluginProcessChild::LLPluginProcessChild()
47{ 47{
48 mState = STATE_UNINITIALIZED; 48 mState = STATE_UNINITIALIZED;
49 mInstance = NULL; 49 mInstance = NULL;
50 mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); 50 mSocket = LLSocket::create(LLSocket::STREAM_TCP);
51 mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz 51 mSleepTime = PLUGIN_IDLE_SECONDS; // default: send idle messages at 100Hz
52 mCPUElapsed = 0.0f; 52 mCPUElapsed = 0.0f;
53 mBlockingRequest = false; 53 mBlockingRequest = false;
@@ -94,18 +94,18 @@ void LLPluginProcessChild::idle(void)
94 } 94 }
95 else if(mSocketError != APR_SUCCESS) 95 else if(mSocketError != APR_SUCCESS)
96 { 96 {
97 LL_INFOS("Plugin") << "message pipe is in error state (" << mSocketError << "), moving to STATE_ERROR"<< LL_ENDL; 97 LL_INFOS("PluginChild") << "message pipe is in error state (" << mSocketError << "), moving to STATE_ERROR"<< LL_ENDL;
98 setState(STATE_ERROR); 98 setState(STATE_ERROR);
99 } 99 }
100 100
101 if((mState > STATE_INITIALIZED) && (mMessagePipe == NULL)) 101 if((mState > STATE_INITIALIZED) && (mMessagePipe == NULL))
102 { 102 {
103 // The pipe has been closed -- we're done. 103 // The pipe has been closed -- we're done.
104 // TODO: This could be slightly more subtle, but I'm not sure it needs to be. 104 // TODO: This could be slightly more subtle, but I'm not sure it needs to be.
105 LL_INFOS("Plugin") << "message pipe went away, moving to STATE_ERROR"<< LL_ENDL; 105 LL_INFOS("PluginChild") << "message pipe went away, moving to STATE_ERROR"<< LL_ENDL;
106 setState(STATE_ERROR); 106 setState(STATE_ERROR);
107 } 107 }
108 108
109 // If a state needs to go directly to another state (as a performance enhancement), it can set idle_again to true after calling setState(). 109 // If a state needs to go directly to another state (as a performance enhancement), it can set idle_again to true after calling setState().
110 // USE THIS CAREFULLY, since it can starve other code. Specifically make sure there's no way to get into a closed cycle and never return. 110 // USE THIS CAREFULLY, since it can starve other code. Specifically make sure there's no way to get into a closed cycle and never return.
111 // When in doubt, don't do it. 111 // When in doubt, don't do it.
@@ -291,17 +291,17 @@ void LLPluginProcessChild::sendMessageToPlugin(const LLPluginMessage &message)
291 if (mInstance) 291 if (mInstance)
292 { 292 {
293 std::string buffer = message.generate(); 293 std::string buffer = message.generate();
294 294
295 LL_DEBUGS("Plugin") << "Sending to plugin: " << buffer << LL_ENDL; 295 LL_DEBUGS("PluginChild") << "Sending to plugin: " << buffer << LL_ENDL;
296 LLTimer elapsed; 296 LLTimer elapsed;
297 297
298 mInstance->sendMessage(buffer); 298 mInstance->sendMessage(buffer);
299 299
300 mCPUElapsed += elapsed.getElapsedTimeF64(); 300 mCPUElapsed += elapsed.getElapsedTimeF64();
301 } 301 }
302 else 302 else
303 { 303 {
304 LL_WARNS("Plugin") << "mInstance == NULL" << LL_ENDL; 304 LL_WARNS("PluginChild") << "mInstance == NULL" << LL_ENDL;
305 } 305 }
306} 306}
307 307
@@ -309,7 +309,7 @@ void LLPluginProcessChild::sendMessageToParent(const LLPluginMessage &message)
309{ 309{
310 std::string buffer = message.generate(); 310 std::string buffer = message.generate();
311 311
312 LL_DEBUGS("Plugin") << "Sending to parent: " << buffer << LL_ENDL; 312 LL_DEBUGS("PluginChild") << "Sending to parent: " << buffer << LL_ENDL;
313 313
314 writeMessageRaw(buffer); 314 writeMessageRaw(buffer);
315} 315}
@@ -318,7 +318,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
318{ 318{
319 // Incoming message from the TCP Socket 319 // Incoming message from the TCP Socket
320 320
321 LL_DEBUGS("Plugin") << "Received from parent: " << message << LL_ENDL; 321 LL_DEBUGS("PluginChild") << "Received from parent: " << message << LL_ENDL;
322 322
323 // Decode this message 323 // Decode this message
324 LLPluginMessage parsed; 324 LLPluginMessage parsed;
@@ -365,7 +365,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
365 if(iter != mSharedMemoryRegions.end()) 365 if(iter != mSharedMemoryRegions.end())
366 { 366 {
367 // Need to remove the old region first 367 // Need to remove the old region first
368 LL_WARNS("Plugin") << "Adding a duplicate shared memory segment!" << LL_ENDL; 368 LL_WARNS("PluginChild") << "Adding a duplicate shared memory segment!" << LL_ENDL;
369 } 369 }
370 else 370 else
371 { 371 {
@@ -392,7 +392,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
392 } 392 }
393 else 393 else
394 { 394 {
395 LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL; 395 LL_WARNS("PluginChild") << "Couldn't create a shared memory segment!" << LL_ENDL;
396 delete region; 396 delete region;
397 } 397 }
398 } 398 }
@@ -411,7 +411,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
411 } 411 }
412 else 412 else
413 { 413 {
414 LL_WARNS("Plugin") << "shm_remove for unknown memory segment!" << LL_ENDL; 414 LL_WARNS("PluginChild") << "shm_remove for unknown memory segment!" << LL_ENDL;
415 } 415 }
416 } 416 }
417 else if(message_name == "sleep_time") 417 else if(message_name == "sleep_time")
@@ -421,12 +421,12 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
421 else if(message_name == "crash") 421 else if(message_name == "crash")
422 { 422 {
423 // Crash the plugin 423 // Crash the plugin
424 LL_ERRS("Plugin") << "Plugin crash requested." << LL_ENDL; 424 LL_ERRS("PluginChild") << "Plugin crash requested." << LL_ENDL;
425 } 425 }
426 else if(message_name == "hang") 426 else if(message_name == "hang")
427 { 427 {
428 // Hang the plugin 428 // Hang the plugin
429 LL_WARNS("Plugin") << "Plugin hang requested." << LL_ENDL; 429 LL_WARNS("PluginChild") << "Plugin hang requested." << LL_ENDL;
430 while(1) 430 while(1)
431 { 431 {
432 // wheeeeeeeee...... 432 // wheeeeeeeee......
@@ -434,7 +434,7 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
434 } 434 }
435 else 435 else
436 { 436 {
437 LL_WARNS("Plugin") << "Unknown internal message from parent: " << message_name << LL_ENDL; 437 LL_WARNS("PluginChild") << "Unknown internal message from parent: " << message_name << LL_ENDL;
438 } 438 }
439 } 439 }
440 } 440 }
@@ -449,17 +449,17 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
449 } 449 }
450} 450}
451 451
452/* virtual */ 452/* virtual */
453void LLPluginProcessChild::receivePluginMessage(const std::string &message) 453void LLPluginProcessChild::receivePluginMessage(const std::string &message)
454{ 454{
455 LL_DEBUGS("Plugin") << "Received from plugin: " << message << LL_ENDL; 455 LL_DEBUGS("PluginChild") << "Received from plugin: " << message << LL_ENDL;
456 456
457 if(mBlockingRequest) 457 if(mBlockingRequest)
458 { 458 {
459 // 459 //
460 LL_ERRS("Plugin") << "Can't send a message while already waiting on a blocking request -- aborting!" << LL_ENDL; 460 LL_ERRS("PluginChild") << "Can't send a message while already waiting on a blocking request -- aborting!" << LL_ENDL;
461 } 461 }
462 462
463 // Incoming message from the plugin instance 463 // Incoming message from the plugin instance
464 bool passMessage = true; 464 bool passMessage = true;
465 465
@@ -523,18 +523,18 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message)
523 } 523 }
524 else 524 else
525 { 525 {
526 LL_WARNS("Plugin") << "shm_remove_response for unknown memory segment!" << LL_ENDL; 526 LL_WARNS("PluginChild") << "shm_remove_response for unknown memory segment!" << LL_ENDL;
527 } 527 }
528 } 528 }
529 } 529 }
530 } 530 }
531 531
532 if(passMessage) 532 if(passMessage)
533 { 533 {
534 LL_DEBUGS("Plugin") << "Passing through to parent: " << message << LL_ENDL; 534 LL_DEBUGS("PluginChild") << "Passing through to parent: " << message << LL_ENDL;
535 writeMessageRaw(message); 535 writeMessageRaw(message);
536 } 536 }
537 537
538 while(mBlockingRequest) 538 while(mBlockingRequest)
539 { 539 {
540 // The plugin wants to block and wait for a response to this message. 540 // The plugin wants to block and wait for a response to this message.
@@ -552,8 +552,8 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message)
552 552
553void LLPluginProcessChild::setState(EState state) 553void LLPluginProcessChild::setState(EState state)
554{ 554{
555 LL_DEBUGS("Plugin") << "setting state to " << state << LL_ENDL; 555 LL_DEBUGS("PluginChild") << "setting state to " << state << LL_ENDL;
556 mState = state; 556 mState = state;
557}; 557};
558 558
559void LLPluginProcessChild::deliverQueuedMessages() 559void LLPluginProcessChild::deliverQueuedMessages()