diff options
author | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-07-23 18:00:56 +0200 |
---|---|---|
committer | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-07-23 18:00:56 +0200 |
commit | 8e269cd5d31032a80e80a509399f22bcde9fadf6 (patch) | |
tree | e541eb51819461cd33769abf2995232c2ba60e4c | |
parent | 0c15eb9117d70aef5f798b66922bc573c855e4cd (diff) | |
download | vSomeIP-8e269cd5d31032a80e80a509399f22bcde9fadf6.tar.gz |
Ensure availability is signaled at most once per incoming SD message.
9 files changed, 22 insertions, 14 deletions
diff --git a/config/vsomeip-tcp-client.xml b/config/vsomeip-tcp-client.xml index af93600..e08f27a 100644 --- a/config/vsomeip-tcp-client.xml +++ b/config/vsomeip-tcp-client.xml @@ -1,6 +1,6 @@ <!-- vsomeip test configuration file --> <someip> - <address>192.168.56.102</address> + <address>192.168.56.101</address> <logging> <level>debug</level> <console>true</console> diff --git a/config/vsomeip-tcp-service.xml b/config/vsomeip-tcp-service.xml index 37751c8..123166c 100644 --- a/config/vsomeip-tcp-service.xml +++ b/config/vsomeip-tcp-service.xml @@ -1,6 +1,6 @@ <!-- vsomeip test configuration file --> <someip> - <address>192.168.56.101</address> + <address>192.168.56.102</address> <logging> <level>debug</level> <console>true</console> diff --git a/implementation/endpoints/include/client_endpoint_impl.hpp b/implementation/endpoints/include/client_endpoint_impl.hpp index b65a10c..f648484 100644 --- a/implementation/endpoints/include/client_endpoint_impl.hpp +++ b/implementation/endpoints/include/client_endpoint_impl.hpp @@ -45,6 +45,8 @@ public: bool is_client() const;
+ bool is_connected() const;
+
public:
void connect_cbk(boost::system::error_code const &_error);
void wait_connect_cbk(boost::system::error_code const &_error);
diff --git a/implementation/endpoints/include/endpoint.hpp b/implementation/endpoints/include/endpoint.hpp index f0007d1..eb26b7f 100644 --- a/implementation/endpoints/include/endpoint.hpp +++ b/implementation/endpoints/include/endpoint.hpp @@ -19,6 +19,8 @@ public: virtual void start() = 0;
virtual void stop() = 0;
+ virtual bool is_connected() const = 0;
+
virtual bool send(const byte_t *_data, uint32_t _size, bool _flush = true) = 0;
virtual void enable_magic_cookies() = 0;
virtual void receive() = 0;
diff --git a/implementation/endpoints/include/server_endpoint_impl.hpp b/implementation/endpoints/include/server_endpoint_impl.hpp index 93efa1b..78a2e54 100644 --- a/implementation/endpoints/include/server_endpoint_impl.hpp +++ b/implementation/endpoints/include/server_endpoint_impl.hpp @@ -35,6 +35,7 @@ public: endpoint_type _local, boost::asio::io_service &_io);
bool is_client() const;
+ bool is_connected() const;
bool send(const uint8_t *_data, uint32_t _size, bool _flush);
bool flush(endpoint_type _target);
diff --git a/implementation/endpoints/src/client_endpoint_impl.cpp b/implementation/endpoints/src/client_endpoint_impl.cpp index 5d51823..b7de1be 100644 --- a/implementation/endpoints/src/client_endpoint_impl.cpp +++ b/implementation/endpoints/src/client_endpoint_impl.cpp @@ -48,6 +48,11 @@ bool client_endpoint_impl< Protocol, MaxBufferSize >::is_client() const { }
template < typename Protocol, int MaxBufferSize >
+bool client_endpoint_impl< Protocol, MaxBufferSize >::is_connected() const {
+ return is_connected_;
+}
+
+template < typename Protocol, int MaxBufferSize >
void client_endpoint_impl< Protocol, MaxBufferSize >::stop() {
if (socket_.is_open()) {
socket_.close();
diff --git a/implementation/endpoints/src/server_endpoint_impl.cpp b/implementation/endpoints/src/server_endpoint_impl.cpp index bd68069..6ad224a 100644 --- a/implementation/endpoints/src/server_endpoint_impl.cpp +++ b/implementation/endpoints/src/server_endpoint_impl.cpp @@ -34,6 +34,11 @@ bool server_endpoint_impl< Protocol, MaxBufferSize >::is_client() const { }
template < typename Protocol, int MaxBufferSize >
+bool server_endpoint_impl< Protocol, MaxBufferSize >::is_connected() const {
+ return true;
+}
+
+template < typename Protocol, int MaxBufferSize >
bool server_endpoint_impl< Protocol, MaxBufferSize >::send(
const uint8_t *_data, uint32_t _size, bool _flush) {
#if 0
diff --git a/implementation/routing/src/routing_manager_impl.cpp b/implementation/routing/src/routing_manager_impl.cpp index 83c705f..b8e65bd 100644 --- a/implementation/routing/src/routing_manager_impl.cpp +++ b/implementation/routing/src/routing_manager_impl.cpp @@ -701,7 +701,9 @@ void routing_manager_impl::add_routing_info( service_instances_[_service][its_endpoint.get()] = _instance; services_[_service][_instance] = its_info; stub_->on_offer_service(VSOMEIP_ROUTING_CLIENT, _service, _instance); - host_->on_availability(_service, _instance, true); + + if (its_endpoint->is_connected()) + host_->on_availability(_service, _instance, true); } void routing_manager_impl::del_routing_info( @@ -709,6 +711,8 @@ void routing_manager_impl::del_routing_info( std::shared_ptr< serviceinfo > its_info(find_service(_service, _instance)); if (its_info) { std::shared_ptr< endpoint > its_empty_endpoint; + + // TODO: only tell the application if the service is completely gone host_->on_availability(_service, _instance, false); stub_->on_stop_offer_service(VSOMEIP_ROUTING_CLIENT, _service, _instance); diff --git a/implementation/service_discovery/src/service_discovery_impl.cpp b/implementation/service_discovery/src/service_discovery_impl.cpp index f0b1b19..776beaa 100644 --- a/implementation/service_discovery/src/service_discovery_impl.cpp +++ b/implementation/service_discovery/src/service_discovery_impl.cpp @@ -241,17 +241,6 @@ void service_discovery_impl::process_serviceentry( minor_version_t its_minor = _entry->get_minor_version(); ttl_t its_ttl = _entry->get_ttl(); - VSOMEIP_DEBUG << "Service [" - << std::hex << std::setw(4) << std::setfill('0') - << its_service << "." << its_instance - << "], version " - << std::dec - << (int)its_major << "." << its_minor - << " is offered for " - << its_ttl - << " seconds."; - - // process options for (auto i : { 1, 2 }) { for (auto its_index : _entry->get_options(i)) { std::vector< byte_t > its_option_address; |