evgeny
7799d54c0c
conn_mgr: обновить API на единую точку входа conn_mgr_open_invite, поправить порядок destroy, обновить всех потребителей
...
- conn_mgr_cb_t: 5 параметров (h, node_id, group_id, event, arg)
- conn_mgr_open_invite: единая функция (ni=NULL — обычное, ni!=NULL — invite)
- CONN_EVENT_JOIN для успешного invite
- struct CONN_MGR_HANDLE: добавлен group_id
- bind/unbind в conn_mgr_init/destroy (один на инстанс, перезапись безвредна)
- utun_instance_destroy: conn_mgr_destroy до закрытия сокетов
- cm_ncd_callback: занулять ncd_handle при DOWN, защита от вызова после destroy
- topo_group_connect: свой трекинг handle'ов, conn_mgr_close для отмены
- обновлены: topo_recovery, media_download, media_delivery, chat_sync, тесты
2 months ago
evgeny
153483fd96
media_delivery: обновление и новый тест conn_mgr_handles
2 months ago
evgeny
d310bccf08
fix: memory pool alloc mismatch in tests, db_sync SEND_DATA buffer overflow
...
- test_etcp_router_reconnect, test_etcp_connect, test_stcp_traffic:
replace u_calloc with memory_pool_alloc for TOPO_SOCKMETA4/TOPO_ADDR4
- db_sync.c: fix req[14] -> req[15] — SEND_DATA request header is 15 bytes
(type:1 + from:4 + count:2 + vp:4 + want_from:4)
2 months ago
evgeny
51d6c782ac
voice playback: miniaudio cursor ground truth + EMA smooth decay
...
- SoundManager: add currentPcmCursor()/isCurrentPcmPlaying() via ma_sound_get_cursor_in_pcm_frames / ma_sound_is_playing
- messagedelegate: replace wall-clock position tracking with real miniaudio cursor, remove 200ms hardcoded delay
- messagedelegate: end-of-playback detection via isCurrentPcmPlaying() instead of wall-clock comparison (was killing audio ~200ms early)
- messagedelegate: EMA smoothing of displayFrac/displayElapsed (0.15 factor, 16ms timer)
- messagedelegate: timer continues after audio stops to animate EMA decay to 0 (not mouse-move dependent)
- media_delivery: download progress callback, Ed25519 sig verify, author fallback, content hash check
- conn_mgr: already-connected returns OK with callback instead of error
- chatgui: voice download-pending auto-play, file download progress bar, media bar colors
2 months ago
evgeny
70797f921e
feature: media auto-download + manual download + UI download state indication (Android + desktop)
...
C-layer:
- chat_event.h: CHAT_EVT_ATTACHMENT_DOWNLOADED (14)
- chat_msg.c: fixed md_auto_download (non-NULL done_cb, correct media_base from db_path, use chat_setting for autoload checks)
- chat_msg.c: added chat_core_attachment_download + trampoline for manual download
- chat_core.h: exported attachment_dl_req + trampoline
Android (Kotlin + JNI):
- Message: downloadState field (parse from localAttrs)
- ChatRepository: parse localAttrs for download state
- NativeLib: attachmentDownload() JNI
- MessageBubble: FileBubble with download status icon + tap-to-download
- ChatViewModel: downloadAttachment() + CHAT_EVT_ATTACHMENT_DOWNLOADED handler
- ChatScreen: wire onDownloadFile handler
- android_jni_bridge: utun_bridge_attachment_download + JNI + localAttrs in JSON
Desktop (Qt/C++):
- messagedelegate.h: MsgFileDownloadStateRole, MsgChannelIdRole
- messagelist.cpp: parse localAttrs for file download state
- messagedelegate.cpp: FileBubble with download icon/text + click handler via chat_core_attachment_download_trampoline
- gui_bridge.h: GUI_EVT_ATTACHMENT_DOWNLOADED (14) + callback typedef
- gui_bridge_impl.cpp: event dispatch + setter
- mainwindow.cpp: callback registration -> refresh message list
2 months ago
evgeny
efbb495016
media_delivery: fix SUPER_REPL spam + streaming verification
...
Bugs fixed:
- md_super_peer_add: timeout_tb = 0 → MEDIA_REPL_TIMEOUT_TB (timer fired every poll)
- md_repl_retrans_cb: md from peer->connect_timer (garbage) → peer->md
- md_repl_retrans_cb: removed inflight_count=0 reset (don't resend acked entries)
- stream_ctx: removed unused block_data field (was NULL, caused crash in BLOCK_DONE)
Test improvements:
- stream_completed flag for reliable streaming verification
- File created in <db_dir>/media/ (matches media_index path logic)
- 9/9 full test, 33/33 total
2 months ago
evgeny
b4824de3b8
media_delivery: fix streaming crash, correct file path via media dir
...
- Fix NULL block_data deref in stream_send_chunk_cb
- Test B1: create file in <db_dir>/media/, commit to media_files
- Store media_base in ui_state for streaming handler path resolution
- 8/9 tests pass (streaming works but timing issue with SUPER_REPL flood)
2 months ago
evgeny
a6321e15b3
media_delivery: streaming, fallback, admission control, 8/9 tests
...
- md_handle_block_req: real chunk streaming via etcp_router_on_send_ready
- stream_ctx state machine: backpressure waiter → send chunk → repeat
- content_hash + block_sig on stream completion
- Fallback to author when supernode has no block info
- media_download: author_node_id for peer fallback
- test_media_delivery_full: 8/9 pass (SUPER_HELLO, HAVE_BLOCK, replication, admission, file create)
- Known issue: streaming test hung (BGP route for n1→n2 not established in time)
2 months ago
evgeny
57e6ffed16
media_delivery: admission control + OVERLOADED + full integration test
...
- MEDIA_BLOCK_OVERLOADED (0x0F) subcommand + packed struct
- Admission control: track active_streams, reject > 3 with OVERLOADED
- media_delivery_stream_done() to decrement counter after stream finish
- Auto-download trigger in chat_msg.c (parse media metadata, check settings)
- test_media_delivery_full.c: 9/9 tests on 4 instances
(SUPER_HELLO, HAVE_BLOCK, replication, admission control, OVERLOADED)
- All 33 existing tests still pass (15+5+4+9)
2 months ago
evgeny
5e739176fa
media_delivery: fix etcp_route_send svc_id + integration test
...
Root cause: etcp_route_send reads dgram[0] as svc_id, not subcmd.
router_deliver prepends svc_id byte on receive.
Fixes:
- md_send/md_dl_send/msend: prepend ETCP_RT_ID_MEDIA_DELIVERY to dgram[0]
- md_etcp_recv: read subcmd from data[1] (was data[0])
- etcp_api.h: document dgram[0]=svc_id convention
- media_delivery_set_supernode(): public API for dynamic switching
Tests:
- test_media_delivery_integration: 4/4 (SERVE_REG, HAVE_BLOCK, supernode stop/start)
- All 24 existing tests still pass
2 months ago
evgeny
a863da7737
media_delivery: add tests + fix queue_new NULL ua and index_offset bugs
...
- test_media_delivery_sql: 15 tests (SQL tables, CRUD, packed structs)
- test_media_delivery_download: 5 tests (chunk write/append, sig verify, assembly, cancel)
- Fix: queue_new(NULL) returns NULL — pass inst->ua everywhere
- Fix: queue index offset must be offsetof(struct, key_field) not 0
- Move struct media_download to header for test visibility
2 months ago
evgeny
fb3e34080d
media_delivery: implement full media delivery subsystem (stages 1-8)
...
- topo_group: add BGP node event callbacks (NEW/UPDATE/REMOVE)
- member_sync: add multi-subscriber node_props_changed callback (adm_tags)
- media_delivery: SQLite tables (block_availability + super_sync), full protocol handler
- media_delivery_proto.h: packed protocol structures (15 subcommands)
- media_download: download management, chunk streaming, block assembly, HAVE_BLOCK with retry
- Makefile.am: add media_download.c to builds
2 months ago
evgeny
65dbfa6813
feat: media_async + media_index modules, media_files table, tests
...
- media_async: thread-per-task async engine with primitives (sha256, sign, copy, uuid, file_size)
- media_index: media_files DB table with register_async for indexing chunks
- chat_msg: async media submission via register_async, simplified chat_msg_submit fields
- voice_recorder/attachment_sender: write single file (no chunk splitting on caller side)
- inputbar/messagelist: updated to new simplified submit interface
- test_media_async: 4-thread stress test (200K ops / 2 sec, 0 errors)
- test_media_index: 9 cases covering commit edge cases + async flow
- build: Makefile.am, CMakeLists.txt, utun_sources.cmake updated
2 months ago