diff options
author | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-08-19 12:50:38 +0200 |
---|---|---|
committer | Lutz Bichler <Lutz.Bichler@bmw.de> | 2014-08-19 12:50:38 +0200 |
commit | ff08e5d092641ca99ef9e9bf372adb743bab26b2 (patch) | |
tree | 555f01bb4a5e4dc8e438b80856a0af6906532da9 /implementation | |
parent | 136d6eba9cb27be6567b34e83933f0b3eb60f0a0 (diff) | |
download | vSomeIP-ff08e5d092641ca99ef9e9bf372adb743bab26b2.tar.gz |
Bugfix: routing info was not correctly read at proxy side.
Diffstat (limited to 'implementation')
-rw-r--r-- | implementation/routing/src/routing_manager_proxy.cpp | 29 | ||||
-rw-r--r-- | implementation/routing/src/routing_manager_stub.cpp | 7 |
2 files changed, 18 insertions, 18 deletions
diff --git a/implementation/routing/src/routing_manager_proxy.cpp b/implementation/routing/src/routing_manager_proxy.cpp index a86d8fe..8eacf8d 100644 --- a/implementation/routing/src/routing_manager_proxy.cpp +++ b/implementation/routing/src/routing_manager_proxy.cpp @@ -399,15 +399,16 @@ void routing_manager_proxy::on_message(const byte_t *_data, length_t _size, void routing_manager_proxy::on_routing_info(const byte_t *_data, uint32_t _size) { #if 0 - std::cout << "rmp::on_routing_info: "; + std::stringstream msg; + msg << "rmp::on_routing_info: "; for (int i = 0; i < _size; ++i) - std::cout << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; - std::cout << std::endl; + msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " "; + VSOMEIP_DEBUG << msg.str(); #endif event_type_e its_state(event_type_e::DEREGISTERED); - std::map<service_t, std::map<instance_t, client_t> > old_local_services = - local_services_; + std::map<service_t, + std::map<instance_t, client_t> > old_local_services = local_services_; local_services_.clear(); uint32_t i = 0; @@ -427,29 +428,27 @@ void routing_manager_proxy::on_routing_info(const byte_t *_data, its_state = event_type_e::REGISTERED; } - if (i + sizeof(uint32_t) <= _size) { + uint32_t j = 0; + while (j + sizeof(uint32_t) <= its_client_size) { uint32_t its_services_size; - std::memcpy(&its_services_size, &_data[i], sizeof(uint32_t)); - i += sizeof(uint32_t); + std::memcpy(&its_services_size, &_data[i + j], sizeof(uint32_t)); + j += sizeof(uint32_t); - uint32_t j = 0; - while (j + sizeof(service_t) + sizeof(instance_t) - <= its_services_size) { + if (its_services_size <= sizeof(service_t) + sizeof(instance_t)) { service_t its_service; std::memcpy(&its_service, &_data[i + j], sizeof(service_t)); j += sizeof(service_t); instance_t its_instance; - std::memcpy(&its_instance, &_data[i + j], - sizeof(instance_t)); + std::memcpy(&its_instance, &_data[i + j], sizeof(instance_t)); j += sizeof(instance_t); if (its_client != client_) local_services_[its_service][its_instance] = its_client; } - - i += its_services_size; } + + i += j; } } diff --git a/implementation/routing/src/routing_manager_stub.cpp b/implementation/routing/src/routing_manager_stub.cpp index b62c8bc..380cb22 100644 --- a/implementation/routing/src/routing_manager_stub.cpp +++ b/implementation/routing/src/routing_manager_stub.cpp @@ -285,10 +285,11 @@ void routing_manager_stub::send_routing_info(client_t _client) { sizeof(its_size)); its_size += VSOMEIP_COMMAND_PAYLOAD_POS; #if 0 - std::cout << "rms::send_routing_info "; + std::stringstream msg; + msg << "rms::send_routing_info "; for (int i = 0; i < its_size; ++i) - std::cout << std::hex << std::setw(2) << std::setfill('0') << (int)its_command[i] << " "; - std::cout << std::endl; + msg << std::hex << std::setw(2) << std::setfill('0') << (int)its_command[i] << " "; + VSOMEIP_DEBUG << msg.str(); #endif its_endpoint->send(&its_command[0], its_size, true); } |