feat: simplify udp listen

This commit is contained in:
2025-09-25 20:44:31 +02:00
parent 51bd7bd909
commit 356ec3d381
4 changed files with 19 additions and 39 deletions

View File

@@ -319,18 +319,18 @@ curl -X POST http://192.168.1.100/api/tasks/control \
### Before (with wrapper functions):
```cpp
void discoverySendTask() { cluster.sendDiscovery(); }
void discoveryListenTask() { cluster.listenForDiscovery(); }
void clusterListenTask() { cluster.listen(); }
taskManager.registerTask("discovery_send", interval, discoverySendTask);
taskManager.registerTask("discovery_listen", interval, discoveryListenTask);
taskManager.registerTask("cluster_listen", interval, clusterListenTask);
```
### After (with std::bind):
```cpp
taskManager.registerTask("discovery_send", interval,
std::bind(&ClusterManager::sendDiscovery, &cluster));
taskManager.registerTask("discovery_listen", interval,
std::bind(&ClusterManager::listenForDiscovery, &cluster));
taskManager.registerTask("cluster_listen", interval,
std::bind(&ClusterManager::listen, &cluster));
```
## Compatibility