Skip to content

Commit

Permalink
some refactoring to cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed May 3, 2024
1 parent 1ee75f8 commit bfe97da
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mbtserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions include/mbtserver/MbtServerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace MbtServer {
private:
void callback( childArgs* );
void createServers( const TiCC::Configuration * );
protected:
std::map<std::string, Tagger::TaggerClass *> experiments;
};

Expand Down
6 changes: 2 additions & 4 deletions src/MbtJSONServerBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<MbtJSONServerClass*>( args->mother() );
MbtJSONServerClass *theServer = dynamic_cast<MbtJSONServerClass*>( args->mother() ); // needed tot have SLOG en SDBG work
int sockId = args->id();
TaggerClass *exp = 0;
map<string, TaggerClass*> experiments =
*(static_cast<map<string, TaggerClass*> *>(callback_data()));
json out_json;
out_json["status"] = "ok";
string baseName = "default";
Expand Down Expand Up @@ -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"];
}
Expand All @@ -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"];
}
Expand Down
5 changes: 1 addition & 4 deletions src/MbtServerBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, TaggerClass*> experiments =
*(static_cast<const map<string, TaggerClass*> *>(callback_data()));

args->os() << "Welcome to the Mbt server." << endl;
string baseName = "default";
if ( experiments.size() > 1 ){
map<string,TaggerClass*>::const_iterator it = experiments.begin();
bool first = true;
Expand All @@ -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;
}
Expand Down

0 comments on commit bfe97da

Please sign in to comment.