Skip to content
Snippets Groups Projects
Commit 6bbb80dd authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Trivial cleanup

parent 2d387957
No related branches found
No related tags found
No related merge requests found
...@@ -468,8 +468,8 @@ void LLPluginProcessParent::idle(void) ...@@ -468,8 +468,8 @@ void LLPluginProcessParent::idle(void)
// If we got here, we're listening. // If we got here, we're listening.
setState(STATE_LISTENING); setState(STATE_LISTENING);
break;
} }
break;
case STATE_LISTENING: case STATE_LISTENING:
{ {
...@@ -512,28 +512,28 @@ void LLPluginProcessParent::idle(void) ...@@ -512,28 +512,28 @@ void LLPluginProcessParent::idle(void)
mHeartbeat.setTimerExpirySec(mPluginLaunchTimeout); mHeartbeat.setTimerExpirySec(mPluginLaunchTimeout);
setState(STATE_LAUNCHED); setState(STATE_LAUNCHED);
} }
break;
} }
break;
case STATE_LAUNCHED: case STATE_LAUNCHED:
{
// waiting for the plugin to connect // waiting for the plugin to connect
if(pluginLockedUpOrQuit()) if(pluginLockedUpOrQuit())
{ {
errorState(); errorState();
} }
else // Check for the incoming connection.
else if (accept())
{ {
// Check for the incoming connection. // Stop listening on the server port
if(accept()) mListenSocket.reset();
{ setState(STATE_CONNECTED);
// Stop listening on the server port
mListenSocket.reset();
setState(STATE_CONNECTED);
}
} }
break; break;
}
case STATE_CONNECTED: case STATE_CONNECTED:
{
// waiting for hello message from the plugin // waiting for hello message from the plugin
if(pluginLockedUpOrQuit()) if(pluginLockedUpOrQuit())
...@@ -541,8 +541,10 @@ void LLPluginProcessParent::idle(void) ...@@ -541,8 +541,10 @@ void LLPluginProcessParent::idle(void)
errorState(); errorState();
} }
break; break;
}
case STATE_HELLO: case STATE_HELLO:
{
LL_DEBUGS("Plugin") << "received hello message" << LL_ENDL; LL_DEBUGS("Plugin") << "received hello message" << LL_ENDL;
// Send the message to load the plugin // Send the message to load the plugin
...@@ -555,32 +557,40 @@ void LLPluginProcessParent::idle(void) ...@@ -555,32 +557,40 @@ void LLPluginProcessParent::idle(void)
setState(STATE_LOADING); setState(STATE_LOADING);
break; break;
}
case STATE_LOADING: case STATE_LOADING:
{
// The load_plugin_response message will kick us from here into STATE_RUNNING // The load_plugin_response message will kick us from here into STATE_RUNNING
if(pluginLockedUpOrQuit()) if(pluginLockedUpOrQuit())
{ {
errorState(); errorState();
} }
break; break;
}
case STATE_RUNNING: case STATE_RUNNING:
{
if(pluginLockedUpOrQuit()) if(pluginLockedUpOrQuit())
{ {
errorState(); errorState();
} }
break; break;
}
case STATE_GOODBYE: case STATE_GOODBYE:
{ {
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shutdown_plugin"); LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shutdown_plugin");
sendMessage(message); sendMessage(message);
} }
setState(STATE_EXITING); setState(STATE_EXITING);
break; break;
}
case STATE_EXITING: case STATE_EXITING:
if (! LLProcess::isRunning(mProcess)) {
if (!LLProcess::isRunning(mProcess))
{ {
setState(STATE_CLEANUP); setState(STATE_CLEANUP);
} }
...@@ -590,36 +600,44 @@ void LLPluginProcessParent::idle(void) ...@@ -590,36 +600,44 @@ void LLPluginProcessParent::idle(void)
errorState(); errorState();
} }
break; break;
}
case STATE_LAUNCH_FAILURE: case STATE_LAUNCH_FAILURE:
{
if(mOwner != NULL) if(mOwner != NULL)
{ {
mOwner->pluginLaunchFailed(); mOwner->pluginLaunchFailed();
} }
setState(STATE_CLEANUP); setState(STATE_CLEANUP);
break; break;
}
case STATE_ERROR: case STATE_ERROR:
{
if(mOwner != NULL) if(mOwner != NULL)
{ {
mOwner->pluginDied(); mOwner->pluginDied();
} }
setState(STATE_CLEANUP); setState(STATE_CLEANUP);
break; break;
}
case STATE_CLEANUP: case STATE_CLEANUP:
{
LLProcess::kill(mProcess); LLProcess::kill(mProcess);
killSockets(); killSockets();
setState(STATE_DONE); setState(STATE_DONE);
dirtyPollSet(); dirtyPollSet();
break; break;
}
case STATE_DONE: case STATE_DONE:
// just sit here. // just sit here.
break; break;
} }
} while (idle_again); }
while (idle_again);
} }
bool LLPluginProcessParent::isLoading(void) bool LLPluginProcessParent::isLoading(void)
...@@ -760,11 +778,9 @@ void LLPluginProcessParent::updatePollset() ...@@ -760,11 +778,9 @@ void LLPluginProcessParent::updatePollset()
sPollSet = NULL; sPollSet = NULL;
} }
mapInstances_t::iterator iter;
int count = 0;
// Count the number of instances that want to be in the pollset // Count the number of instances that want to be in the pollset
for(iter = sInstances.begin(); iter != sInstances.end(); iter++) S32 count = 0;
for(auto iter = sInstances.begin(); iter != sInstances.end(); iter++)
{ {
(*iter).second->mPolledInput = false; (*iter).second->mPolledInput = false;
if ((*iter).second->wantsPolling()) if ((*iter).second->wantsPolling())
...@@ -793,9 +809,9 @@ void LLPluginProcessParent::updatePollset() ...@@ -793,9 +809,9 @@ void LLPluginProcessParent::updatePollset()
LL_DEBUGS("PluginPoll") << "created pollset " << sPollSet << LL_ENDL; LL_DEBUGS("PluginPoll") << "created pollset " << sPollSet << LL_ENDL;
// Pollset was created, add all instances to it. // Pollset was created, add all instances to it.
for(iter = sInstances.begin(); iter != sInstances.end(); iter++) for(auto iter = sInstances.begin(); iter != sInstances.end(); iter++)
{ {
if ((*iter).second->wantsPolling()) if (iter->second->wantsPolling())
{ {
status = apr_pollset_add(sPollSet, &((*iter).second->mPollFD)); status = apr_pollset_add(sPollSet, &((*iter).second->mPollFD));
if(status == APR_SUCCESS) if(status == APR_SUCCESS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment