Changes: acceptConn() => accept(), closeConn() => close(), socket pool is cleared on closeAllSockets().

pull/1/head
Jussi Lind 15 years ago
parent 0d04c011a0
commit 98758a08f7

@ -125,12 +125,12 @@ bool Booster::readCommand()
m_conn = new Connection(socketId());
// Accept a new invocation.
if (m_conn->acceptConn(m_app))
if (m_conn->accept(m_app))
{
// Receive application data from the invoker
if(!m_conn->receiveApplicationData(m_app))
{
m_conn->closeConn();
m_conn->close();
return false;
}
@ -138,7 +138,7 @@ bool Booster::readCommand()
// to be sent back to invoker
if (!m_conn->isReportAppExitStatusNeeded())
{
m_conn->closeConn();
m_conn->close();
}
return true;
}
@ -161,10 +161,9 @@ void Booster::run()
if (m_conn->isReportAppExitStatusNeeded())
{
m_conn->sendAppExitStatus(ret_val);
m_conn->closeConn();
m_conn->close();
Connection::closeAllSockets();
}
}
else
{

@ -73,10 +73,10 @@ void Connection::closeAllSockets()
{
if (it->second > 0)
{
close(it->second);
it->second = -1;
::close(it->second);
}
}
socketPool.clear();
}
int Connection::findSocket(const string socketId)
@ -127,11 +127,11 @@ void Connection::initSocket(const string socketId)
}
}
bool Connection::acceptConn(AppData & rApp)
bool Connection::accept(AppData & rApp)
{
if (!m_testMode)
{
m_fd = accept(m_curSocket, NULL, NULL);
m_fd = ::accept(m_curSocket, NULL, NULL);
if (m_fd < 0)
{
@ -156,7 +156,7 @@ bool Connection::acceptConn(AppData & rApp)
Logger::logError("Connection: invoker doesn't have enough credentials to call launcher \n");
sendMsg(INVOKER_MSG_BAD_CREDS);
closeConn();
close();
return false;
}
@ -168,13 +168,13 @@ bool Connection::acceptConn(AppData & rApp)
return true;
}
void Connection::closeConn()
void Connection::close()
{
if (m_fd != -1)
{
if (!m_testMode)
{
close(m_fd);
::close(m_fd);
}
m_fd = -1;

@ -69,10 +69,10 @@ public:
* in rApp must be released by the caller.
* \return true on success.
*/
bool acceptConn(AppData & rApp);
bool accept(AppData & rApp);
//! \brief Close the socket connection.
void closeConn();
void close();
//! \brief Receive application data to rApp.
bool receiveApplicationData(AppData & rApp);

@ -36,6 +36,8 @@ const string & MBooster::socketId() const
bool MBooster::preload()
{
#ifdef HAVE_MCOMPONENTCACHE
// Populate the cache (instantiates an MApplicationWindow and
// an MApplication)
MComponentCache::populateForMApplication();
#endif
return true;

@ -99,7 +99,7 @@ void Ut_Connection::testSocket()
QVERIFY(conn->m_fd > 0);
conn->closeConn();
conn->close();
QVERIFY(conn->m_fd == -1);
unlink(socketName);

Loading…
Cancel
Save