summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gehring <juergen.gehring@bmw.de>2018-01-25 00:40:04 -0800
committerJuergen Gehring <juergen.gehring@bmw.de>2018-01-25 00:40:04 -0800
commit5c43d511bd5b5e15eca521c4c71dfa69c6f1c90f (patch)
tree8fbc25fee09ffb9dcd91541fb970ba451e58c8db
parente47085cbf1fb0e8daf958513161ab47e059dc275 (diff)
downloadvSomeIP-5c43d511bd5b5e15eca521c4c71dfa69c6f1c90f.tar.gz
vsomeip 2.9.52.9.5
-rw-r--r--CHANGES7
-rw-r--r--CMakeLists.txt2
-rw-r--r--implementation/endpoints/include/tcp_client_endpoint_impl.hpp2
-rw-r--r--implementation/endpoints/include/tcp_server_endpoint_impl.hpp3
-rw-r--r--implementation/endpoints/src/tcp_client_endpoint_impl.cpp15
-rw-r--r--implementation/endpoints/src/tcp_server_endpoint_impl.cpp11
-rw-r--r--implementation/routing/src/routing_manager_impl.cpp30
-rw-r--r--implementation/service_discovery/src/service_discovery_impl.cpp7
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_client.cpp14
-rw-r--r--test/magic_cookies_tests/magic_cookies_test_service.cpp2
11 files changed, 71 insertions, 24 deletions
diff --git a/CHANGES b/CHANGES
index 2baf179..cbdb2a8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,12 @@
Changes
=======
+
+v2.9.5
+- Change magic cookie behaviour to only send a magic cookie every 10
+ seconds instead of in front of every SOME/IP message
+- Fixed bug which prevented resubscription after resuming from
+ suspended state
+
v2.9.4
- Fixed deadlock on suspend to RAM / resume, triggered
by signal handler.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 364959f..14d2b2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ project (vsomeip)
set (VSOMEIP_MAJOR_VERSION 2)
set (VSOMEIP_MINOR_VERSION 9)
-set (VSOMEIP_PATCH_VERSION 4)
+set (VSOMEIP_PATCH_VERSION 5)
set (VSOMEIP_VERSION ${VSOMEIP_MAJOR_VERSION}.${VSOMEIP_MINOR_VERSION}.${VSOMEIP_PATCH_VERSION})
set (PACKAGE_VERSION ${VSOMEIP_VERSION}) # Used in documentatin/doxygen.in
set (CMAKE_VERBOSE_MAKEFILE off)
diff --git a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
index 991949c..e6b0a4a 100644
--- a/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
+++ b/implementation/endpoints/include/tcp_client_endpoint_impl.hpp
@@ -7,6 +7,7 @@
#define VSOMEIP_TCP_CLIENT_ENDPOINT_IMPL_HPP
#include <boost/asio/ip/tcp.hpp>
+#include <chrono>
#include <vsomeip/defines.hpp>
#include "client_endpoint_impl.hpp"
@@ -61,6 +62,7 @@ private:
const boost::asio::ip::address remote_address_;
const std::uint16_t remote_port_;
+ std::chrono::steady_clock::time_point last_cookie_sent_;
};
} // namespace vsomeip
diff --git a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
index 1fd4052..fd725d2 100644
--- a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
@@ -15,6 +15,8 @@
#include <vsomeip/export.hpp>
#include "server_endpoint_impl.hpp"
+#include <chrono>
+
namespace vsomeip {
typedef server_endpoint_impl<
@@ -108,6 +110,7 @@ private:
boost::asio::ip::address remote_address_;
std::uint16_t remote_port_;
std::atomic<bool> magic_cookies_enabled_;
+ std::chrono::steady_clock::time_point last_cookie_sent_;
};
std::mutex acceptor_mutex_;
diff --git a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
index f0a0e10..17c96c2 100644
--- a/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_client_endpoint_impl.cpp
@@ -35,7 +35,8 @@ tcp_client_endpoint_impl::tcp_client_endpoint_impl(
shrink_count_(0),
buffer_shrink_threshold_(_buffer_shrink_threshold),
remote_address_(_remote.address()),
- remote_port_(_remote.port()) {
+ remote_port_(_remote.port()),
+ last_cookie_sent_(std::chrono::steady_clock::now() - std::chrono::seconds(11)) {
is_supporting_magic_cookies_ = true;
}
@@ -174,8 +175,16 @@ void tcp_client_endpoint_impl::send_queued() {
return;
}
- if (has_enabled_magic_cookies_)
- send_magic_cookie(its_buffer);
+ if (has_enabled_magic_cookies_) {
+ const std::chrono::steady_clock::time_point now =
+ std::chrono::steady_clock::now();
+ if (std::chrono::duration_cast<std::chrono::milliseconds>(
+ now - last_cookie_sent_) > std::chrono::milliseconds(10000)) {
+ send_magic_cookie(its_buffer);
+ last_cookie_sent_ = now;
+ }
+ }
+
#if 0
std::stringstream msg;
diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
index 8e643c1..f91f7f6 100644
--- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
@@ -213,7 +213,8 @@ tcp_server_endpoint_impl::connection::connection(
shrink_count_(0),
buffer_shrink_threshold_(_buffer_shrink_threshold),
remote_port_(0),
- magic_cookies_enabled_(_magic_cookies_enabled) {
+ magic_cookies_enabled_(_magic_cookies_enabled),
+ last_cookie_sent_(std::chrono::steady_clock::now() - std::chrono::seconds(11)) {
}
tcp_server_endpoint_impl::connection::ptr
@@ -303,7 +304,13 @@ void tcp_server_endpoint_impl::connection::send_queued(
}
message_buffer_ptr_t its_buffer = _queue_iterator->second.front();
if (magic_cookies_enabled_) {
- send_magic_cookie(its_buffer);
+ const std::chrono::steady_clock::time_point now =
+ std::chrono::steady_clock::now();
+ if (std::chrono::duration_cast<std::chrono::milliseconds>(
+ now - last_cookie_sent_) > std::chrono::milliseconds(10000)) {
+ send_magic_cookie(its_buffer);
+ last_cookie_sent_ = now;
+ }
}
{
diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp
index 5e53382..594d687 100644
--- a/implementation/routing/src/routing_manager_impl.cpp
+++ b/implementation/routing/src/routing_manager_impl.cpp
@@ -3692,21 +3692,6 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) {
}
}
- // determine existing subscriptions to remote services and send StopSubscribe
- for (auto &s : get_services()) {
- for (auto &i : s.second) {
- if (find_local_client(s.first, i.first) != VSOMEIP_ROUTING_CLIENT) {
- continue; //don't expire local services
- }
- for (auto its_eventgroup : get_subscribed_eventgroups(s.first, i.first)) {
- discovery_->unsubscribe(s.first, i.first, its_eventgroup, VSOMEIP_ROUTING_CLIENT);
- auto specific_endpoint_clients = get_specific_endpoint_clients(s.first, i.first);
- for (auto its_client : specific_endpoint_clients) {
- discovery_->unsubscribe(s.first, i.first, its_eventgroup, its_client);
- }
- }
- }
- }
// mark all external services as offline
services_t its_remote_services;
{
@@ -3715,9 +3700,24 @@ void routing_manager_impl::set_routing_state(routing_state_e _routing_state) {
}
for (const auto &s : its_remote_services) {
for (const auto &i : s.second) {
+ // determine existing subscriptions to remote service and send StopSubscribe
+ for (auto its_eventgroup : get_subscribed_eventgroups(s.first, i.first)) {
+ discovery_->unsubscribe(s.first, i.first, its_eventgroup, VSOMEIP_ROUTING_CLIENT);
+ auto specific_endpoint_clients = get_specific_endpoint_clients(s.first, i.first);
+ for (auto its_client : specific_endpoint_clients) {
+ discovery_->unsubscribe(s.first, i.first, its_eventgroup, its_client);
+ }
+ for (const auto &e : find_events(s.first, i.first, its_eventgroup)) {
+ e->clear_subscribers();
+ }
+ }
+
const bool has_reliable(i.second->get_endpoint(true));
const bool has_unreliable(i.second->get_endpoint(false));
del_routing_info(s.first, i.first, has_reliable, has_unreliable);
+
+ // clear all cached payloads of remote services
+ unset_all_eventpayloads(s.first, i.first);
}
}
break;
diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp
index 57bb465..d4a8964 100644
--- a/implementation/service_discovery/src/service_discovery_impl.cpp
+++ b/implementation/service_discovery/src/service_discovery_impl.cpp
@@ -145,7 +145,8 @@ void service_discovery_impl::start() {
return;
}
}
- {
+
+ if (is_suspended_) {
// make sure to sent out FindService messages after resume
std::lock_guard<std::mutex> its_lock(requested_mutex_);
for (const auto &s : requested_) {
@@ -153,6 +154,10 @@ void service_discovery_impl::start() {
i.second->set_sent_counter(0);
}
}
+ if (endpoint_) {
+ // rejoin multicast group
+ endpoint_->join(sd_multicast_);
+ }
}
is_suspended_ = false;
start_main_phase_timer();
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d1337e7..c82123e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -2089,7 +2089,7 @@ if(NOT ${TESTS_BAT})
add_test(NAME ${TEST_MAGIC_COOKIES_NAME}
COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MAGIC_COOKIES_STARTER}
)
- set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 120)
+ set_tests_properties(${TEST_MAGIC_COOKIES_NAME} PROPERTIES TIMEOUT 250)
# Header/Factory tets
add_test(NAME ${TEST_HEADER_FACTORY_NAME} COMMAND ${TEST_HEADER_FACTORY})
diff --git a/test/magic_cookies_tests/magic_cookies_test_client.cpp b/test/magic_cookies_tests/magic_cookies_test_client.cpp
index a6afacd..4be0889 100644
--- a/test/magic_cookies_tests/magic_cookies_test_client.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_client.cpp
@@ -163,32 +163,46 @@ public:
// Test sequence
its_good_payload_data[11] = 0x01;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x02;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x03;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x04;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x05;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x06;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x07;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x08;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x09;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x0A;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0B;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0C;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0D;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_bad_payload_data[11] = 0x0E;
its_routing->send(0x1343, its_bad_payload_data, sizeof(its_bad_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
+ std::this_thread::sleep_for(std::chrono::seconds(11));
its_good_payload_data[11] = 0x0F;
its_routing->send(0x1343, its_good_payload_data, sizeof(its_good_payload_data), vsomeip_test::TEST_SERVICE_INSTANCE_ID, true, true);
diff --git a/test/magic_cookies_tests/magic_cookies_test_service.cpp b/test/magic_cookies_tests/magic_cookies_test_service.cpp
index 21e936d..7cd4376 100644
--- a/test/magic_cookies_tests/magic_cookies_test_service.cpp
+++ b/test/magic_cookies_tests/magic_cookies_test_service.cpp
@@ -116,7 +116,7 @@ public:
offer();
while (!blocked_) {
if(std::cv_status::timeout ==
- condition_.wait_for(its_lock, std::chrono::seconds(55))) {
+ condition_.wait_for(its_lock, std::chrono::seconds(200))) {
GTEST_NONFATAL_FAILURE_("Didn't receive all requests within time");
break;
}