Skip to content

Fix TCP-only channel linking when UDP is compiled out - #547

Open
NikolayChirkov wants to merge 1 commit into
mainfrom
fix/ab-ping-pong-tcp-only-v1
Open

Fix TCP-only channel linking when UDP is compiled out#547
NikolayChirkov wants to merge 1 commit into
mainfrom
fix/ab-ping-pong-tcp-only-v1

Conversation

@NikolayChirkov

Copy link
Copy Markdown
Collaborator

Summary

  • Skip server channels whose protocol was compiled out (AE_SUPPORT_UDP=0 / AE_SUPPORT_TCP=0) so persisted UDP channels no longer block TCP linking.
  • Treat null transports from EthernetTransportFactory as build errors in ethernet/wifi TransportConnect instead of dereferencing them.
  • Add examples/a_b_message_exchange/user_config.h for TCP-only desktop ping-pong and wire it as the ESP default USER_CONFIG.

Test plan

  • Configure with -DUSER_CONFIG=examples/a_b_message_exchange/user_config.h -DAE_BUILD_EXAMPLES=ON -DAE_DISTILLATION=ON
  • Build ab-message-exchange
  • Run fresh-state ping-pong: confirm AE_SUPPORT_UDP:0, TCP connects to :9020, CLOUD_SERVER_LINKED, exchange.done, exit 0

cc @BartolomeyKant

Made with Cursor

Skip compiled-out protocols in ServerConnection and treat null transports as build errors so AE_SUPPORT_UDP=0 can select TCP; add ab-message-exchange TCP-only user_config.

Co-authored-by: Cursor <cursoragent@cursor.com>
idf_build_get_property(CM_PLATFORM CM_PLATFORM)
if(CM_PLATFORM STREQUAL "ESP32")
# TCP-only ping-pong config unless the build already selected one.
if("${USER_CONFIG}" STREQUAL "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this affects not ust this example but the whole project. This must be set only by user as the names says.

use cmake config time options like
-DUSER_CONFIG=

// loaded into a TCP-only build). Factory returns nullptr for those and
// the connection would never link.
if (auto endpoint = channel->endpoint()) {
#if !AE_SUPPORT_TCP

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO!
If you want to filter it here, let's add new property for a channel to signal if it's usable with current options.

Currently it just produces nullptr in Channel::TransportBuilder but if we know it would fail anyway we could not even try to build it. The property must be is_usable or is_enabled or is_supported. And it means not just 'compiled out' but unsupported channel for current configuration in general.

For example we had working ethernet adapter earlier but now don't, and channels still saved in persistent state, we could skip them.

[s{std::move(stream)},
link_sub{Subscription{}}](auto& ctx) mutable noexcept {
if (!s) {
// Protocol compiled out (AE_SUPPORT_* = 0) — factory returns null.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not the only reason why s could be empty.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it's obvious we need to check s before use it, so the comment is unnecessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants