Fix TCP-only channel linking when UDP is compiled out - #547
Fix TCP-only channel linking when UDP is compiled out#547NikolayChirkov wants to merge 1 commit into
Conversation
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 "") |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
this is not the only reason why s could be empty.
There was a problem hiding this comment.
also it's obvious we need to check s before use it, so the comment is unnecessary
Summary
AE_SUPPORT_UDP=0/AE_SUPPORT_TCP=0) so persisted UDP channels no longer block TCP linking.EthernetTransportFactoryas build errors in ethernet/wifiTransportConnectinstead of dereferencing them.examples/a_b_message_exchange/user_config.hfor TCP-only desktop ping-pong and wire it as the ESP defaultUSER_CONFIG.Test plan
-DUSER_CONFIG=examples/a_b_message_exchange/user_config.h -DAE_BUILD_EXAMPLES=ON -DAE_DISTILLATION=ONab-message-exchangeAE_SUPPORT_UDP:0, TCP connects to:9020,CLOUD_SERVER_LINKED,exchange.done, exit0cc @BartolomeyKant
Made with Cursor