Removed unnecessary getProtocolState functions.
This commit is contained in:
parent
2909e42a25
commit
e919b97037
@ -177,12 +177,14 @@ void* NetworkConsole::mainLoop(void* data)
|
||||
|
||||
} // while !stop
|
||||
|
||||
uint32_t id = ProtocolManager::getInstance()->requestStart(new StopServer());
|
||||
while(ProtocolManager::getInstance()->getProtocolState(id) != PROTOCOL_STATE_TERMINATED)
|
||||
Protocol *p = new StopServer();
|
||||
while(p->getState() != PROTOCOL_STATE_TERMINATED)
|
||||
{
|
||||
StkTime::sleep(1);
|
||||
}
|
||||
|
||||
delete p;
|
||||
|
||||
main_loop->abort();
|
||||
|
||||
return NULL;
|
||||
|
@ -541,53 +541,6 @@ void ProtocolManager::asynchronousUpdate()
|
||||
pthread_mutex_unlock(&m_requests_mutex);
|
||||
} // asynchronousUpdate
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** \brief Get the state of a protocol using its id.
|
||||
* \param id : The id of the protocol you seek the state.
|
||||
* \return The state of the protocol.
|
||||
*/
|
||||
ProtocolState ProtocolManager::getProtocolState(uint32_t id)
|
||||
{
|
||||
//FIXME that actually need a lock, but it also can be called from
|
||||
// a locked section anyway
|
||||
for (unsigned int i = 0; i < m_protocols.getData().size(); i++)
|
||||
{
|
||||
if (m_protocols.getData()[i]->getId() == id) // we know a protocol with that id
|
||||
return m_protocols.getData()[i]->getState();
|
||||
}
|
||||
// the protocol isn't running right now
|
||||
for (unsigned int i = 0; i < m_requests.size(); i++)
|
||||
{
|
||||
// the protocol is going to be started
|
||||
if (m_requests[i].m_protocol->getId() == id)
|
||||
return PROTOCOL_STATE_RUNNING; // we can say it's running
|
||||
}
|
||||
return PROTOCOL_STATE_TERMINATED; // else, it's already finished
|
||||
} // getProtocolState
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** \brief Get the state of a protocol using a pointer on it.
|
||||
* \param protocol : A pointer to the protocol you seek the state.
|
||||
* \return The state of the protocol.
|
||||
*/
|
||||
ProtocolState ProtocolManager::getProtocolState(Protocol* protocol)
|
||||
{
|
||||
// FIXME Does this need to be locked?
|
||||
for (unsigned int i = 0; i < m_protocols.getData().size(); i++)
|
||||
{
|
||||
if (m_protocols.getData()[i] == protocol) // the protocol is known
|
||||
return m_protocols.getData()[i]->getState();
|
||||
}
|
||||
for (unsigned int i = 0; i < m_requests.size(); i++)
|
||||
{
|
||||
// the protocol is going to be started
|
||||
if (m_requests[i].m_protocol == protocol)
|
||||
return PROTOCOL_STATE_RUNNING; // we can say it's running
|
||||
}
|
||||
// we don't know this protocol at all, it's finished
|
||||
return PROTOCOL_STATE_TERMINATED;
|
||||
} // getProtocolState
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** \brief Get the id of a protocol.
|
||||
* \param protocol : A pointer to the protocol you seek the id.
|
||||
|
@ -127,8 +127,6 @@ class ProtocolManager : public AbstractSingleton<ProtocolManager>,
|
||||
virtual void requestTerminate(Protocol* protocol);
|
||||
virtual void update();
|
||||
virtual void asynchronousUpdate();
|
||||
virtual ProtocolState getProtocolState(uint32_t id);
|
||||
virtual ProtocolState getProtocolState(Protocol* protocol);
|
||||
virtual uint32_t getProtocolID(Protocol* protocol);
|
||||
virtual Protocol* getProtocol(uint32_t id);
|
||||
virtual Protocol* getProtocol(ProtocolType type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user