Add discovery module: UDP multicast announcements and peer tracking
Sends 6-byte framed announcements to 224.0.0.251:5353 on startup and every interval_ms (default 5s). Receive thread maintains a peer table (max 64 entries); fires on_peer_found for new peers, on_peer_lost when a peer misses timeout_intervals (default 3) consecutive intervals. Own announcements are filtered by name+site_id. SO_REUSEADDR+REUSEPORT allows multiple processes on the same host for testing. discovery_cli: announce <name> <tcp_port> [flags] — prints found/lost events. Also notes future config module in planning.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17
src/modules/discovery/Makefile
Normal file
17
src/modules/discovery/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
ROOT := $(abspath ../../..)
|
||||
include $(ROOT)/common.mk
|
||||
|
||||
MODULE_BUILD = $(BUILD)/discovery
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(MODULE_BUILD)/discovery.o
|
||||
|
||||
$(MODULE_BUILD)/discovery.o: discovery.c $(ROOT)/include/discovery.h | $(MODULE_BUILD)
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(MODULE_BUILD):
|
||||
mkdir -p $@
|
||||
|
||||
clean:
|
||||
rm -f $(MODULE_BUILD)/discovery.o
|
||||
Reference in New Issue
Block a user