stcp: separate v4/v6 sockets, protocol byte in chat addr format, error on bind fail
- stcp_server_create: support AF_INET and AF_INET6 V6ONLY=1 (no dual-stack) - Add listen_family to stcp_link_config - init_sockets: return error (not partial) on any bind failure - add chat_core_sync_my_addresses() call at chatgui startup - collect_my_addrs: add proto byte (1=UDP, 2=TCP) to binary format - chat_sync.c JOIN/WELCOME/PEER_UPSERT: read proto byte, write protocol column - member_sync.c: read proto byte, dynamic protocol bind - topo_node.c: debug logs for nodeinfo changed detection - node_config.cpp: type=public for all servers
This commit is contained in:
1 parent
3deaa0eabe
commit
8023f6ee70
20 files changed
+174
-70
No files matched your search
@@ -7,6 +7,7 @@ import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
const val EVT_NODEINFO_UPDATED = 16
|
||||
const val EVT_LINK_STATUS_CHANGED = 17
|
||||
|
||||
data class NodeStatus(
|
||||
val nodeId: Long = 0,
|
||||
|
||||
+1
-6
@@ -30,8 +30,6 @@ import com.utun.chat.data.MemberAddr
|
||||
import com.utun.chat.data.MemberLinks
|
||||
import com.utun.chat.data.LinkStatus
|
||||
import com.utun.chat.viewmodel.ChatViewModel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -52,10 +50,7 @@ fun MemberListScreen(
|
||||
LaunchedEffect(selectedMember?.nodeId) {
|
||||
val nodeId = selectedMember?.nodeId
|
||||
if (nodeId == null) { viewModel.refreshMemberLinks(0); return@LaunchedEffect }
|
||||
while (isActive) {
|
||||
viewModel.refreshMemberLinks(nodeId)
|
||||
delay(1000)
|
||||
}
|
||||
viewModel.refreshMemberLinks(nodeId)
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.fillMaxSize().navigationBarsPadding()) {
|
||||
|
||||
@@ -196,6 +196,13 @@ class ChatViewModel : ViewModel() {
|
||||
val cur = _currentChannel.value
|
||||
if (cur != null) refreshMembers(cur.id)
|
||||
}
|
||||
17 -> { /* LINK_STATUS_CHANGED: [peer_id:8][link_id:1][state:1][status:1][links_up:1][initialized:1] */
|
||||
if (data == null || data.size < 13) return
|
||||
val buf = java.nio.ByteBuffer.wrap(data).order(java.nio.ByteOrder.LITTLE_ENDIAN)
|
||||
val nodeId = buf.getLong()
|
||||
val detail = _selectedMember.value
|
||||
if (detail != null && detail.nodeId == nodeId) refreshMemberLinks(nodeId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user