mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 16:47:47 +00:00
[udp] add kNetifThreadInternal which disallows platform UDP use (#10965)
This commit introduces `kNetifThreadInternal` as a network interface option for UDP sockets. Unlike other options, this disallows the use of platform UDP for the socket, indicating that the socket should use the OpenThread internal Thread network interface only. This model replaces the previous approach where `ShouldUsePlatformUdp()` would check the socket port against a set of port numbers used by different modules (such as MLE, TMF, Joiner Router, etc) to determine whether platform UDP APIs should be used. With the new model, each module decides whether to associate its socket with the `kNetifThreadInternal`. This is a more flexible and extensible model, ensuring that sockets that should not use the platform do not waste resources (they will not be created or opened/closed on the platform). This also help avoid edge cases where platform UDP operations may unintentionally fail when the platform socket is not actually needed.
This commit is contained in:
@@ -1076,7 +1076,7 @@ void TestSrpClientDelayedResponse(void)
|
||||
|
||||
sServerRxCount = 0;
|
||||
|
||||
SuccessOrQuit(udpSocket.Open(Ip6::kNetifThread));
|
||||
SuccessOrQuit(udpSocket.Open(Ip6::kNetifThreadHost));
|
||||
SuccessOrQuit(udpSocket.Bind(kServerPort));
|
||||
|
||||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Reference in New Issue
Block a user