From bfe97da0dab06ac04ebe40138981feb472dad32f Mon Sep 17 00:00:00 2001 From: Ko van der Sloot Date: Fri, 3 May 2024 09:24:08 +0200 Subject: [PATCH] some refactoring to cleanup --- .github/workflows/mbtserver.yml | 2 +- include/mbtserver/MbtServerBase.h | 1 + src/MbtJSONServerBase.cxx | 6 ++---- src/MbtServerBase.cxx | 5 +---- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/mbtserver.yml b/.github/workflows/mbtserver.yml index 0f524f6..96bb1ce 100644 --- a/.github/workflows/mbtserver.yml +++ b/.github/workflows/mbtserver.yml @@ -2,7 +2,7 @@ name: C/C++ CI on: schedule: - - cron: "0 23 * * 6" + - cron: "0 23 2 * 5" # run test once a month push: branches: [master] diff --git a/include/mbtserver/MbtServerBase.h b/include/mbtserver/MbtServerBase.h index c91bf95..5672c75 100644 --- a/include/mbtserver/MbtServerBase.h +++ b/include/mbtserver/MbtServerBase.h @@ -44,6 +44,7 @@ namespace MbtServer { private: void callback( childArgs* ); void createServers( const TiCC::Configuration * ); + protected: std::map experiments; }; diff --git a/src/MbtJSONServerBase.cxx b/src/MbtJSONServerBase.cxx index 522d97d..5737b45 100644 --- a/src/MbtJSONServerBase.cxx +++ b/src/MbtJSONServerBase.cxx @@ -69,11 +69,9 @@ namespace MbtServer { // ***** This is the routine that is executed from a new thread ********** void MbtJSONServerClass::callback( childArgs *args ){ - MbtJSONServerClass *theServer = dynamic_cast( args->mother() ); + MbtJSONServerClass *theServer = dynamic_cast( args->mother() ); // needed tot have SLOG en SDBG work int sockId = args->id(); TaggerClass *exp = 0; - map experiments = - *(static_cast *>(callback_data())); json out_json; out_json["status"] = "ok"; string baseName = "default"; @@ -102,7 +100,6 @@ namespace MbtServer { SLOG << "handling JSON" << in_json.dump(2) << endl; } string command; - string param; if ( in_json.find( "command" ) != in_json.end() ){ command = in_json["command"]; } @@ -116,6 +113,7 @@ namespace MbtServer { args->os() << err_json << endl; } if ( command == "base" ){ + string param; if ( in_json.find("param") != in_json.end() ){ param = in_json["param"]; } diff --git a/src/MbtServerBase.cxx b/src/MbtServerBase.cxx index cdd0658..b287dd6 100644 --- a/src/MbtServerBase.cxx +++ b/src/MbtServerBase.cxx @@ -155,11 +155,7 @@ namespace MbtServer { // ***** This is the routine that is executed from a new thread ********** void MbtServerClass::callback( childArgs *args ){ ServerBase *theServer = args->mother(); - map experiments = - *(static_cast *>(callback_data())); - args->os() << "Welcome to the Mbt server." << endl; - string baseName = "default"; if ( experiments.size() > 1 ){ map::const_iterator it = experiments.begin(); bool first = true; @@ -184,6 +180,7 @@ namespace MbtServer { SDBG << "Line='" << Line << "'" << endl; string command, param; Split( Line, command, param ); + string baseName = "default"; if ( command == "base" ){ baseName = param; }