From bb8223f4e4541f2d05394f1b4d92d5629cb1742f Mon Sep 17 00:00:00 2001 From: Alexey Shilov Date: Thu, 12 Aug 2010 17:07:14 +0300 Subject: [PATCH] Changes: close connection with invoker if --wait-term param is not used --- src/invoker/invoker.c | 6 +++--- src/launcher/booster.cpp | 10 +++++----- src/launcher/connection.cpp | 5 +++++ src/launcher/connection.h | 4 ++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/invoker/invoker.c b/src/invoker/invoker.c index 2488c22..7dd1349 100644 --- a/src/invoker/invoker.c +++ b/src/invoker/invoker.c @@ -387,7 +387,7 @@ static unsigned int get_delay(char *delay_arg) return delay; } -static void invoke(int prog_argc, char **prog_argv, char *prog_name, +static int invoke(int prog_argc, char **prog_argv, char *prog_name, enum APP_TYPE app_type, int magic_options, bool wait_term) { if (prog_name && prog_argv) @@ -536,7 +536,7 @@ int main(int argc, char *argv[]) } // Send commands to the launcher daemon info("Invoking execution: '%s'\n", prog_name); - invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term); + int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term); // Sleep for delay before exiting if (delay) @@ -546,5 +546,5 @@ int main(int argc, char *argv[]) sleep(delay); } - return 0; + return ret_val; } diff --git a/src/launcher/booster.cpp b/src/launcher/booster.cpp index e3d7030..9259791 100644 --- a/src/launcher/booster.cpp +++ b/src/launcher/booster.cpp @@ -55,13 +55,13 @@ bool Booster::readCommand() // Accept a new invocation. if (conn.acceptConn()) { - if (conn.receiveApplicationData(m_app)) + bool res = conn.receiveApplicationData(m_app); + + if (!conn.reportAppExitStatus()) { - return true; + conn.closeConn(); } - - // Close connection - conn.closeConn(); + return true; } return false; diff --git a/src/launcher/connection.cpp b/src/launcher/connection.cpp index b24a92d..04bd43b 100644 --- a/src/launcher/connection.cpp +++ b/src/launcher/connection.cpp @@ -519,3 +519,8 @@ bool Connection::receiveApplicationData(AppData & rApp) return true; } + +bool Connection::reportAppExitStatus() +{ + return m_sendPid; +} diff --git a/src/launcher/connection.h b/src/launcher/connection.h index 06c0460..e2ac012 100644 --- a/src/launcher/connection.h +++ b/src/launcher/connection.h @@ -75,6 +75,10 @@ public: //! \brief Receive application data to rApp. bool receiveApplicationData(AppData & rApp); + + //! \brief Return true if invoker wait for process exit status + bool reportAppExitStatus(); + /*! \brief Initialize a file socket. * \param socketId Path to the socket file */