fix chatgui: self in member list, online status on reconnect, lb spam
- cs_handle_welcome(): add self to local peers_<ch_id> so joiner sees own account in channel member list - cs_on_conn_up(): post CHANNEL_PEERS_ONLINE after reconnect so GUI shows connected status (was only posted on conn_down) - etcp_loadbalancer: DEBUG_WARN -> DEBUG_DEBUG for no suitable link: tmr:wait — normal shaper behavior, not a warning
This commit is contained in:
1 parent
cbcef7a814
commit
88b95a7702
2 files changed
+17
-1
No files matched your search
@@ -57,7 +57,7 @@ struct ETCP_LINK* etcp_loadbalancer_select_link(struct ETCP_CONN* etcp) {
|
||||
|
||||
if (available_count == 0) {
|
||||
if (etcp->links)
|
||||
DEBUG_WARN(DEBUG_CATEGORY_ETCP, "[%s] no suitable link found: tmr:%s",
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] no suitable link found: tmr:%s",
|
||||
etcp->log_name, etcp->links->shaper_timer?"wait":"rdy");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -513,6 +513,10 @@ static void cs_on_conn_up(struct ETCP_CONN* conn, void* arg) {
|
||||
}
|
||||
|
||||
member_sync_set_online(g_cs->inst, peer, 1);
|
||||
for (int i = 0; i < g_cs->channel_count; i++) {
|
||||
for (int j = 0; j < g_cs->channels[i].peer_count; j++)
|
||||
if (g_cs->channels[i].peer_ids[j] == peer) { cs_post_channel_online(g_cs, g_cs->channels[i].channel_id); break; }
|
||||
}
|
||||
}
|
||||
|
||||
static void cs_on_conn_down(struct ETCP_CONN* conn, void* arg) {
|
||||
@@ -1204,6 +1208,18 @@ static void cs_handle_welcome(struct chat_sync* cs, uint64_t peer,
|
||||
|
||||
cs_refresh_channels(cs);
|
||||
|
||||
/* add self to local peers table (server added joiner to its DB; client must do the same) */
|
||||
{
|
||||
uint64_t myid = cs->inst->node_id;
|
||||
const uint8_t* my_x25 = cs->inst->my_keys.public_key;
|
||||
const uint8_t* my_ed = cs->inst->my_ed25519_pubkey;
|
||||
const char* my_name = cs->inst->name[0] ? cs->inst->name : "";
|
||||
int src = topo_node_sqlite_member_put(db, ch_id, myid, NULL, 0, NULL, 0, my_x25, my_ed, my_name, NULL);
|
||||
if (src != 0)
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTIVITY, "%s: member_put(self) FAILED in WELCOME ch=%s rc=%d", CS_ID, ch_id, src);
|
||||
else
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "%s: WELCOME added self to peers ch=%s node=0x%016llx", CS_ID, ch_id, (unsigned long long)myid);
|
||||
}
|
||||
|
||||
uint8_t evt[65]; uint8_t ch_id_len = (uint8_t)strlen(ch_id);
|
||||
evt[0] = ch_id_len; memcpy(evt + 1, ch_id, ch_id_len);
|
||||
|
||||
Reference in new issue
Block a user