Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpc_manager: use SteadyTime for timeout #1134

Merged
merged 1 commit into from
Aug 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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