Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion implementation/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@vsomeip//bazel:version.bzl", "version_dict_from_string")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

APEX_VSOMEIP_VERSION_TAG = "3.6.0-apex3" # This version must match the git tag version.
APEX_VSOMEIP_VERSION_TAG = "3.6.0-apex3-sender-port-logs" # Must match the git tag version.

expand_template(
name = "config",
Expand Down
4 changes: 4 additions & 0 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1627,8 +1627,12 @@ void configuration_impl::load_service_discovery(const configuration_element& _el
its_converter << its_value;
its_converter >> sd_port_;
if (!sd_port_) {
VSOMEIP_INFO << "cfg::load_service_discovery no port configured (value=" << its_value
<< "), falling back to default " << VSOMEIP_SD_DEFAULT_PORT;
sd_port_ = VSOMEIP_SD_DEFAULT_PORT;
} else {
VSOMEIP_INFO << "cfg::load_service_discovery using configured SD port " << sd_port_
<< " from " << _element.name_;
is_configured_[ET_SERVICE_DISCOVERY_PORT] = true;
}
}
Expand Down
4 changes: 4 additions & 0 deletions implementation/endpoints/src/endpoint_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ std::shared_ptr<endpoint> endpoint_manager_impl::create_server_endpoint(uint16_t
its_tmp->enable_magic_cookies();
}
its_server_endpoint = its_tmp;
VSOMEIP_INFO << "emi::create_server_endpoint TCP bound to "
<< its_unicast.to_string() << ":" << _port;
}
}
} else {
Expand All @@ -250,6 +252,8 @@ std::shared_ptr<endpoint> endpoint_manager_impl::create_server_endpoint(uint16_t
its_tmp->init(its_unreliable, its_error);
if (!its_error) {
its_server_endpoint = its_tmp;
VSOMEIP_INFO << "emi::create_server_endpoint UDP bound to "
<< its_unicast.to_string() << ":" << _port;
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion implementation/routing/src/routing_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,11 @@ bool routing_manager_impl::send_via_sd(const std::shared_ptr<endpoint_definition
is_sent = its_endpoint->send_to(_target, _data, _size);
#ifdef USE_DLT
if (is_sent && tc_->is_sd_enabled()) {
VSOMEIP_INFO << "rmi::send_via_sd using existing SD endpoint "
<< (its_endpoint->is_reliable() ? "TCP" : "UDP")
<< " local_port=" << its_endpoint->get_local_port()
<< " remote=" << _target->get_address().to_string() << ":" << _target->get_port()
<< " sd_port=" << _sd_port;
trace::header its_header;
if (its_header.prepare(its_endpoint, true, 0x0))
tc_->trace(its_header.data_, VSOMEIP_TRACE_HEADER_SIZE, _data, _size);
Expand Down Expand Up @@ -1933,8 +1938,12 @@ std::shared_ptr<endpoint> routing_manager_impl::create_service_discovery_endpoin
} catch (const std::exception& e) {
VSOMEIP_ERROR << "Server endpoint creation failed: Service "
"Discovery endpoint could not be created: "
<< e.what();
<< e.what();
}
} else {
VSOMEIP_INFO << "rmi::create_service_discovery_endpoint reuse existing "
<< (_reliable ? "TCP" : "UDP") << " SD endpoint bound to local_port="
<< its_service_endpoint->get_local_port() << " configured_port=" << _port;
}
return its_service_endpoint;
}
Expand Down
19 changes: 19 additions & 0 deletions implementation/service_discovery/src/service_discovery_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ void service_discovery_impl::init() {
reliable_ = (configuration_->get_sd_protocol() == "tcp");
max_message_size_ = (reliable_ ? VSOMEIP_MAX_TCP_SD_PAYLOAD : VSOMEIP_MAX_UDP_SD_PAYLOAD);

VSOMEIP_INFO << "sd::init using " << (reliable_ ? "TCP" : "UDP")
<< " service-discovery port " << port_ << " unicast " << unicast_.to_string()
<< " multicast " << sd_multicast_;

ttl_ = configuration_->get_sd_ttl();

// generate random initial delay based on initial delay min and max
Expand Down Expand Up @@ -141,6 +145,14 @@ void service_discovery_impl::start() {
VSOMEIP_ERROR << "Couldn't start service discovery";
return;
}

// Log which local socket ended up being used for SD (multicast/broadcast sends)
auto udp_ep = std::dynamic_pointer_cast<udp_server_endpoint_impl>(endpoint_);
if (udp_ep) {
VSOMEIP_INFO << "sd::start bound SD UDP socket to "
<< unicast_.to_string() << ":" << udp_ep->get_local_port()
<< " (configured port=" << port_ << ")";
}
}
{
std::lock_guard<std::mutex> its_lock(sessions_received_mutex_);
Expand Down Expand Up @@ -2305,6 +2317,9 @@ bool service_discovery_impl::send(const std::vector<std::shared_ptr<message_impl
m->set_reboot_flag(its_session.second);
if (host_->send(VSOMEIP_SD_CLIENT, m, true)) {
increment_session(unicast_);
VSOMEIP_INFO << "sd::serialize_and_send(local) sent SD message via default route from "
<< unicast_.to_string() << ":" << port_
<< " (reliable=" << std::boolalpha << reliable_ << ")";
}
} else {
its_result = false;
Expand All @@ -2328,6 +2343,10 @@ bool service_discovery_impl::serialize_and_send(const std::vector<std::shared_pt
if (host_->send_via_sd(endpoint_definition::get(_address, port_, reliable_, m->get_service(), m->get_instance()),
serializer_->get_data(), serializer_->get_size(), port_)) {
increment_session(_address);
VSOMEIP_INFO << "sd::serialize_and_send(to " << _address.to_string() << ")" << " sent from "
<< unicast_.to_string() << ":" << port_ << " to "
<< _address.to_string() << ":" << port_ << " (reliable="
<< std::boolalpha << reliable_ << ")";
}
} else {
VSOMEIP_ERROR << "service_discovery_impl::" << __func__ << ": Serialization failed!";
Expand Down
Loading