Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed May 2, 2024
1 parent bbd8584 commit 73fd00c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion demos/sockettestServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int randomSecs(){
}

void *do_to_child( void *arg ){
Sockets::Socket *mysock = (Sockets::Socket*)arg;
Sockets::Socket *mysock = static_cast<Sockets::Socket*>(arg);
// Greeting message for the client
//
//
Expand Down
8 changes: 4 additions & 4 deletions include/timblserver/ClientBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ namespace TimblServer {
bool connect( const std::string&, const std::string& );
const std::string& getBase( ) const { return _base; };
bool setBase( const std::string& );
const std::set<std::string> baseNames() const { return bases;};
const std::set<std::string>& baseNames() const { return bases;};
bool classify( const std::string& );
bool classifyFile( std::istream&, std::ostream& );
bool runScript( std::istream&, std::ostream& );
std::string getClass() const { return Class; };
std::string getDistance() const { return distance; };
std::string getDistribution() const { return distribution; };
const std::string& getClass() const { return Class; };
const std::string& getDistance() const { return distance; };
const std::string& getDistribution() const { return distribution; };
const std::vector<std::string>& getNeighbors() const { return neighbors; };
private:
bool extractBases( const std::string& );
Expand Down
6 changes: 3 additions & 3 deletions src/HttpServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void HttpServer::callback( childArgs *args ){
// report connection to the server terminal
//
args->socket()->setNonBlocking();
map<string, TimblExperiment*> experiments =
map<string, TimblExperiment*> my_experiments =
*(static_cast<map<string, TimblExperiment*> *>(callback_data()));
string logLine = "Thread " + to_string( (uintptr_t)pthread_self() )
+ " on Socket " + to_string( args->id() );
Expand Down Expand Up @@ -112,8 +112,8 @@ void HttpServer::callback( childArgs *args ){
epos = basename.find( "/" );
if ( epos != string::npos ){
basename = basename.substr( epos+1 );
auto exp_it = experiments.find(basename);
if ( exp_it != experiments.end() ){
auto exp_it = my_experiments.find(basename);
if ( exp_it != my_experiments.end() ){
TimblThread *client = new TimblThread( exp_it->second, args );
if ( client ){
TiCC::LogStream LS( &logstream() );
Expand Down
14 changes: 7 additions & 7 deletions src/JsonServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ void JsonServer::callback( childArgs *args ){
JsonServer *theServer = dynamic_cast<JsonServer*>( args->mother() );
int sockId = args->id();
TimblThread *client = 0;
map<string, TimblExperiment*> experiments =
map<string, TimblExperiment*> my_experiments =
*(static_cast<map<string, TimblExperiment*> *>(callback_data()));

int result = 0;
json out_json;
out_json["status"] = "ok";
if ( experiments.size() == 1
&& experiments.find("default") != experiments.end() ){
if ( my_experiments.size() == 1
&& my_experiments.find("default") != my_experiments.end() ){
DBG << "Before Create Default Client " << endl;
TimblExperiment *exp = experiments["default"];
TimblExperiment *exp = my_experiments["default"];
client = new TimblThread( exp, args, true );
DBG << "After Create Client " << endl;
// report connection to the server terminal
//
}
else {
json arr = json::array();
for ( const auto& it : experiments ){
for ( const auto& it : my_experiments ){
arr.push_back( it.first );
}
out_json["available_bases"] = arr;
Expand Down Expand Up @@ -166,8 +166,8 @@ void JsonServer::callback( childArgs *args ){
args->os() << err_json << endl;
}
else {
auto it = experiments.find(param);
if ( it != experiments.end() ){
auto it = my_experiments.find(param);
if ( it != my_experiments.end() ){
// args->os() << "selected base: '" << Params << "'" << endl;
if ( client ){
delete client;
Expand Down

0 comments on commit 73fd00c

Please sign in to comment.