Skip to content

Commit

Permalink
Merge pull request #1134 from flixr/xmlrpc_steady_timeout
Browse files Browse the repository at this point in the history
xmlrpc_manager: use SteadyTime for timeout
  • Loading branch information
dirk-thomas authored Aug 14, 2017
2 parents ef118af + 18e1a80 commit 940945c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clients/roscpp/include/ros/xmlrpc_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ROSCPP_DECL CachedXmlRpcClient
}

bool in_use_;
ros::WallTime last_use_time_; // for reaping
ros::SteadyTime last_use_time_; // for reaping
XmlRpc::XmlRpcClient* client_;

static const ros::WallDuration s_zombie_time_; // how long before it is toasted
Expand Down
6 changes: 3 additions & 3 deletions clients/roscpp/src/libros/xmlrpc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ XmlRpcClient* XMLRPCManager::getXMLRPCClient(const std::string &host, const int
// hooray, it's pointing at our destination. re-use it.
c = i->client_;
i->in_use_ = true;
i->last_use_time_ = WallTime::now();
i->last_use_time_ = SteadyTime::now();
break;
}
else if (i->last_use_time_ + CachedXmlRpcClient::s_zombie_time_ < WallTime::now())
else if (i->last_use_time_ + CachedXmlRpcClient::s_zombie_time_ < SteadyTime::now())
{
// toast this guy. he's dead and nobody is reusing him.
delete i->client_;
Expand All @@ -362,7 +362,7 @@ XmlRpcClient* XMLRPCManager::getXMLRPCClient(const std::string &host, const int
c = new XmlRpcClient(host.c_str(), port, uri.c_str());
CachedXmlRpcClient mc(c);
mc.in_use_ = true;
mc.last_use_time_ = WallTime::now();
mc.last_use_time_ = SteadyTime::now();
clients_.push_back(mc);
//ROS_INFO("%d xmlrpc clients allocated\n", xmlrpc_clients.size());
}
Expand Down

0 comments on commit 940945c

Please sign in to comment.