diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-12-18 13:55:41 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-12-18 13:55:41 -0500 |
commit | 3f81bb15b32cfa9db2a1a3cbcf0eb976b7751368 (patch) | |
tree | d534594be435e7cc1a5ca5c14b8b146ed47bb2e2 /indra/llplugin/llpluginprocesschild.cpp | |
parent | 99f4b27020c101591de5c1cbe53185c610e48caa (diff) | |
parent | 7b993d15b70d419dc0a7c8d92286d34a2635537d (diff) |
merge
Diffstat (limited to 'indra/llplugin/llpluginprocesschild.cpp')
-rwxr-xr-x | indra/llplugin/llpluginprocesschild.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index f8a282184e..be80d38305 100755 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -33,6 +33,7 @@ #include "llpluginmessagepipe.h" #include "llpluginmessageclasses.h" +static const F32 GOODBYE_SECONDS = 20.0f; static const F32 HEARTBEAT_SECONDS = 1.0f; static const F32 PLUGIN_IDLE_SECONDS = 1.0f / 100.0f; // Each call to idle will give the plugin this much time. @@ -194,33 +195,43 @@ void LLPluginProcessChild::idle(void) } } // receivePluginMessage will transition to STATE_UNLOADING - break; + break; + + case STATE_SHUTDOWNREQ: + if (mInstance != NULL) + { + sendMessageToPlugin(LLPluginMessage("base", "cleanup")); + delete mInstance; + mInstance = NULL; + } + setState(STATE_UNLOADING); + mWaitGoodbye.setTimerExpirySec(GOODBYE_SECONDS); + break; case STATE_UNLOADING: - if(mInstance != NULL) - { - sendMessageToPlugin(LLPluginMessage("base", "cleanup")); - delete mInstance; - mInstance = NULL; - } - setState(STATE_UNLOADED); - break; + // waiting for goodbye from plugin. + if (mWaitGoodbye.hasExpired()) + { + LL_WARNS() << "Wait for goodbye expired. Advancing to UNLOADED" << LL_ENDL; + setState(STATE_UNLOADED); + } + break; case STATE_UNLOADED: killSockets(); setState(STATE_DONE); - break; + break; case STATE_ERROR: // Close the socket to the launcher killSockets(); // TODO: Where do we go from here? Just exit()? setState(STATE_DONE); - break; + break; case STATE_DONE: // just sit here. - break; + break; } } while (idle_again); @@ -350,6 +361,10 @@ void LLPluginProcessChild::receiveMessageRaw(const std::string &message) mPluginFile = parsed.getValue("file"); mPluginDir = parsed.getValue("dir"); } + else if (message_name == "shutdown_plugin") + { + setState(STATE_SHUTDOWNREQ); + } else if(message_name == "shm_add") { std::string name = parsed.getValue("name"); @@ -495,6 +510,10 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message) // Let the parent know it's loaded and initialized. sendMessageToParent(new_message); } + else if (message_name == "goodbye") + { + setState(STATE_UNLOADED); + } else if(message_name == "shm_remove_response") { // Don't pass this message up to the parent |