summaryrefslogtreecommitdiff
path: root/indra/llplugin/llpluginprocessparent.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2009-12-18 13:24:29 -0600
committerDave Parks <davep@lindenlab.com>2009-12-18 13:24:29 -0600
commit6aa71844a8949ab3c75b6cbe1a5f8cb811aa27b8 (patch)
treee73b1d2847a33c7568688f85265913a69d1711a2 /indra/llplugin/llpluginprocessparent.cpp
parent5015886e1763887f534321790d56b6cee5a75dfa (diff)
parentd5b53eb483ec042d83859ec957dce7699c7469aa (diff)
Merge with viewer-2-0
Diffstat (limited to 'indra/llplugin/llpluginprocessparent.cpp')
-rw-r--r--indra/llplugin/llpluginprocessparent.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp
index f60838b1e7..49f9783824 100644
--- a/indra/llplugin/llpluginprocessparent.cpp
+++ b/indra/llplugin/llpluginprocessparent.cpp
@@ -39,12 +39,6 @@
#include "llapr.h"
-// If we don't receive a heartbeat in this many seconds, we declare the plugin locked up.
-static const F32 PLUGIN_LOCKED_UP_SECONDS = 15.0f;
-
-// Somewhat longer timeout for initial launch.
-static const F32 PLUGIN_LAUNCH_SECONDS = 20.0f;
-
//virtual
LLPluginProcessParentOwner::~LLPluginProcessParentOwner()
{
@@ -59,10 +53,11 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
mDisableTimeout = false;
mDebug = false;
- // initialize timer - heartbeat test (mHeartbeat.hasExpired())
- // can sometimes return true immediately otherwise and plugins
- // fail immediately because it looks like
- mHeartbeat.setTimerExpirySec(PLUGIN_LOCKED_UP_SECONDS);
+ mPluginLaunchTimeout = 60.0f;
+ mPluginLockupTimeout = 15.0f;
+
+ // Don't start the timer here -- start it when we actually launch the plugin process.
+ mHeartbeat.stop();
}
LLPluginProcessParent::~LLPluginProcessParent()
@@ -79,8 +74,10 @@ LLPluginProcessParent::~LLPluginProcessParent()
// and remove it from our map
mSharedMemoryRegions.erase(iter);
}
-
- mProcess.kill();
+
+ // orphaning the process means it won't be killed when the LLProcessLauncher is destructed.
+ // This is what we want -- it should exit cleanly once it notices the sockets have been closed.
+ mProcess.orphan();
killSockets();
}
@@ -323,7 +320,7 @@ void LLPluginProcessParent::idle(void)
// This will allow us to time out if the process never starts.
mHeartbeat.start();
- mHeartbeat.setTimerExpirySec(PLUGIN_LAUNCH_SECONDS);
+ mHeartbeat.setTimerExpirySec(mPluginLaunchTimeout);
setState(STATE_LAUNCHED);
}
}
@@ -414,7 +411,8 @@ void LLPluginProcessParent::idle(void)
break;
case STATE_CLEANUP:
- mProcess.kill();
+ // Don't do a kill here anymore -- closing the sockets is the new 'kill'.
+ mProcess.orphan();
killSockets();
setState(STATE_DONE);
break;
@@ -556,7 +554,7 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
else if(message_name == "heartbeat")
{
// this resets our timer.
- mHeartbeat.setTimerExpirySec(PLUGIN_LOCKED_UP_SECONDS);
+ mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
mCPUUsage = message.getValueReal("cpu_usage");
@@ -711,7 +709,7 @@ bool LLPluginProcessParent::pluginLockedUpOrQuit()
bool LLPluginProcessParent::pluginLockedUp()
{
- // If the timer has expired, the plugin has locked up.
- return mHeartbeat.hasExpired();
+ // If the timer is running and has expired, the plugin has locked up.
+ return (mHeartbeat.getStarted() && mHeartbeat.hasExpired());
}