43 #include <boost/bind/bind.hpp>
51 const std::string& response_md5sum,
const M_string& header_values)
52 : service_name_(service_name)
53 , persistent_(persistent)
54 , request_md5sum_(request_md5sum)
55 , response_md5sum_(response_md5sum)
56 , extra_outgoing_header_values_(header_values)
57 , header_written_(false)
74 boost::mutex::scoped_lock lock(local->finished_mutex_);
75 local->finished_ =
true;
76 local->finished_condition_.notify_all();
79 if (boost::this_thread::get_id() != info->caller_thread_id_)
81 while (!local->call_finished_)
83 boost::this_thread::yield();
144 ROS_ERROR(
"TCPROS header from service server did not have required element: md5sum");
196 uint8_t
ok = buffer[0];
197 uint32_t len = *((uint32_t*)(buffer.get() + 1));
199 if (len > 1000000000)
201 ROS_ERROR(
"a message of over a gigabyte was " \
202 "predicted in tcpros. that seems highly " \
203 "unlikely, so I'll assume protocol " \
204 "synchronization is lost.");
246 current_call_->exception_string_ = std::string(
reinterpret_cast<char*
>(buffer.get()), size);
259 boost::mutex::scoped_lock finished_lock(
current_call_->finished_mutex_);
273 self = shared_from_this();
335 info->success_ =
false;
336 info->finished_ =
false;
337 info->call_finished_ =
false;
338 info->caller_thread_id_ = boost::this_thread::get_id();
342 bool immediate =
false;
347 info->call_finished_ =
true;
367 boost::mutex::scoped_lock lock(info->finished_mutex_);
369 while (!info->finished_)
371 info->finished_condition_.wait(lock);
375 info->call_finished_ =
true;
377 if (info->exception_string_.length() > 0)
379 ROS_ERROR(
"Service call failed: service [%s] responded with an error: %s",
service_name_.c_str(), info->exception_string_.c_str());
382 return info->success_;