From 929a405aff737004ecf44bd0a67c4d23d7c92736 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Mon, 12 Oct 2020 15:42:03 +0800 Subject: [PATCH 1/3] set call_finished_ with true for each call inside callFinished and also set current_call flags when failure happens Signed-off-by: Chen Lihui --- clients/roscpp/src/libros/service_server_link.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clients/roscpp/src/libros/service_server_link.cpp b/clients/roscpp/src/libros/service_server_link.cpp index 47f340f779..2f444a9ef6 100644 --- a/clients/roscpp/src/libros/service_server_link.cpp +++ b/clients/roscpp/src/libros/service_server_link.cpp @@ -198,6 +198,10 @@ void ServiceServerLink::onResponseOkAndLength(const ConnectionPtr& conn, const b if (len > 1000000000) { + { + boost::mutex::scoped_lock lock(call_queue_mutex_); + current_call_->call_finished_ = true; + } ROS_ERROR("a message of over a gigabyte was " \ "predicted in tcpros. that seems highly " \ "unlikely, so I'll assume protocol " \ @@ -262,6 +266,7 @@ void ServiceServerLink::callFinished() current_call_->finished_ = true; current_call_->finished_condition_.notify_all(); + current_call_->call_finished_ = true; saved_call = current_call_; current_call_ = CallInfoPtr(); From e1a06e24b1c27081b5106ff68d1c2f4f216f8b80 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Wed, 14 Oct 2020 09:30:07 +0800 Subject: [PATCH 2/3] Update based on review Co-authored-by: Tomoya.Fujita Signed-off-by: Chen Lihui --- clients/roscpp/src/libros/service_server_link.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/clients/roscpp/src/libros/service_server_link.cpp b/clients/roscpp/src/libros/service_server_link.cpp index 2f444a9ef6..2a81738d4e 100644 --- a/clients/roscpp/src/libros/service_server_link.cpp +++ b/clients/roscpp/src/libros/service_server_link.cpp @@ -198,10 +198,6 @@ void ServiceServerLink::onResponseOkAndLength(const ConnectionPtr& conn, const b if (len > 1000000000) { - { - boost::mutex::scoped_lock lock(call_queue_mutex_); - current_call_->call_finished_ = true; - } ROS_ERROR("a message of over a gigabyte was " \ "predicted in tcpros. that seems highly " \ "unlikely, so I'll assume protocol " \ @@ -376,7 +372,10 @@ bool ServiceServerLink::call(const SerializedMessage& req, SerializedMessage& re } } - info->call_finished_ = true; + if (!info->call_finished_) + { + info->call_finished_ = true; + } if (info->exception_string_.length() > 0) { From 9437cfc4c6013f54ee0a240eac11020bfbb25328 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Thu, 15 Oct 2020 14:19:53 +0800 Subject: [PATCH 3/3] set the flag with true again even if it is true already Signed-off-by: Chen Lihui --- clients/roscpp/src/libros/service_server_link.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clients/roscpp/src/libros/service_server_link.cpp b/clients/roscpp/src/libros/service_server_link.cpp index 2a81738d4e..735a16e579 100644 --- a/clients/roscpp/src/libros/service_server_link.cpp +++ b/clients/roscpp/src/libros/service_server_link.cpp @@ -372,10 +372,7 @@ bool ServiceServerLink::call(const SerializedMessage& req, SerializedMessage& re } } - if (!info->call_finished_) - { - info->call_finished_ = true; - } + info->call_finished_ = true; if (info->exception_string_.length() > 0) {