fix: prevent autoping disable on false negative ping support check
All checks were successful
CI Code / Check spelling (pull_request) Successful in 21s
CI Code / Check coding style (pull_request) Successful in 36s
CI Code / Linux (arch) (pull_request) Successful in 12m57s
CI Code / Linux (ubuntu) (pull_request) Successful in 13m59s
CI Code / Linux (debian) (pull_request) Successful in 16m35s
CI Code / Check spelling (push) Successful in 19s
CI Code / Check coding style (push) Successful in 38s
CI Code / Linux (arch) (push) Successful in 10m10s
CI Code / Linux (debian) (push) Successful in 13m50s
CI Code / Linux (ubuntu) (push) Successful in 16m42s
All checks were successful
CI Code / Check spelling (pull_request) Successful in 21s
CI Code / Check coding style (pull_request) Successful in 36s
CI Code / Linux (arch) (pull_request) Successful in 12m57s
CI Code / Linux (ubuntu) (pull_request) Successful in 13m59s
CI Code / Linux (debian) (pull_request) Successful in 16m35s
CI Code / Check spelling (push) Successful in 19s
CI Code / Check coding style (push) Successful in 38s
CI Code / Linux (arch) (push) Successful in 10m10s
CI Code / Linux (debian) (push) Successful in 13m50s
CI Code / Linux (ubuntu) (push) Successful in 16m42s
Remove autodisable logic (prefs_set_autoping(0)) and early return in autoping to treat intermittent false negatives from connection_supports(XMPP_FEATURE_PING). Add one-time error display with debug features print for monitoring; warn on first failing check without aborting to maintain functionality while investigating root cause.
This commit is contained in:
@@ -979,6 +979,7 @@ _connection_handler(xmpp_conn_t* const xmpp_conn, const xmpp_conn_event_t status
|
||||
|
||||
connection_get_jid();
|
||||
conn.domain = strdup(conn.jid->domainpart);
|
||||
log_debug("conn.domain=%s", conn.jid->domainpart);
|
||||
|
||||
connection_clear_data();
|
||||
conn.features_by_jid = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)g_hash_table_destroy);
|
||||
@@ -1163,3 +1164,32 @@ connection_get_profanity_identifier(void)
|
||||
{
|
||||
return prof_identifier;
|
||||
}
|
||||
|
||||
void
|
||||
connection_debug_print_features()
|
||||
{
|
||||
log_debug("=== Connection Features ===");
|
||||
|
||||
GHashTableIter iter;
|
||||
gpointer jid_ptr, features_ptr;
|
||||
|
||||
g_hash_table_iter_init(&iter, conn.features_by_jid);
|
||||
while (g_hash_table_iter_next(&iter, &jid_ptr, &features_ptr)) {
|
||||
const char* jid = (const char*)jid_ptr;
|
||||
GHashTable* features = (GHashTable*)features_ptr;
|
||||
|
||||
if (!features || g_hash_table_size(features) == 0) {
|
||||
log_debug("%s:\t(no features)", jid);
|
||||
continue;
|
||||
}
|
||||
|
||||
GList* feature_keys = g_hash_table_get_keys(features);
|
||||
for (GList* l = feature_keys; l != NULL; l = l->next) {
|
||||
const char* feature = (const char*)l->data;
|
||||
log_debug("%s:\t%s", jid, feature);
|
||||
}
|
||||
g_list_free(feature_keys);
|
||||
}
|
||||
|
||||
log_debug("=== End of Features ===");
|
||||
}
|
||||
|
||||
@@ -1417,6 +1417,8 @@ _manual_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gboolean autoping_error_shown = false;
|
||||
|
||||
static int
|
||||
_autoping_timed_send(xmpp_conn_t* const conn, void* const userdata)
|
||||
{
|
||||
@@ -1425,10 +1427,13 @@ _autoping_timed_send(xmpp_conn_t* const conn, void* const userdata)
|
||||
}
|
||||
|
||||
if (connection_supports(XMPP_FEATURE_PING) == FALSE) {
|
||||
log_warning("Server doesn't advertise %s feature, disabling autoping.", XMPP_FEATURE_PING);
|
||||
prefs_set_autoping(0);
|
||||
cons_show_error("Server ping not supported (%s), autoping disabled.", XMPP_FEATURE_PING);
|
||||
return 0;
|
||||
// TODO: do we need to check it on each autoping call?
|
||||
log_warning("Server doesn't advertise %s feature.", XMPP_FEATURE_PING);
|
||||
if (!autoping_error_shown) {
|
||||
connection_debug_print_features();
|
||||
cons_show_error("Server ping not supported (%s). Check log for details.", XMPP_FEATURE_PING);
|
||||
}
|
||||
autoping_error_shown = 1;
|
||||
}
|
||||
|
||||
if (autoping_wait) {
|
||||
@@ -1499,7 +1504,7 @@ _auto_pong_id_handler(xmpp_stanza_t* const stanza, void* const userdata)
|
||||
if (g_strcmp0(errtype, STANZA_TYPE_CANCEL) == 0) {
|
||||
log_warning("Server ping (id=%s) error type 'cancel', disabling autoping.", id);
|
||||
prefs_set_autoping(0);
|
||||
cons_show_error("Server ping not supported, autoping disabled.");
|
||||
cons_show_error("Autoping is not supported by the server (stanza cancelled). The feature has been disabled automatically.");
|
||||
xmpp_timed_handler_delete(connection_get_conn(), _autoping_timed_send);
|
||||
}
|
||||
|
||||
@@ -2515,6 +2520,7 @@ _disco_items_result_handler(xmpp_stanza_t* const stanza)
|
||||
GSList* items = NULL;
|
||||
|
||||
if ((g_strcmp0(id, "discoitemsreq") != 0) && (g_strcmp0(id, "discoitemsreq_onconnect") != 0)) {
|
||||
log_warning("_disco_items_result_handler: Received unexpected disco id: %s", id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,8 @@ const char* connection_jid_for_feature(const char* const feature);
|
||||
|
||||
const char* connection_get_profanity_identifier(void);
|
||||
|
||||
void connection_debug_print_features();
|
||||
|
||||
char* message_send_chat(const char* const barejid, const char* const msg, const char* const oob_url, gboolean request_receipt, const char* const replace_id);
|
||||
char* message_send_chat_otr(const char* const barejid, const char* const msg, gboolean request_receipt, const char* const replace_id);
|
||||
char* message_send_chat_pgp(const char* const barejid, const char* const msg, gboolean request_receipt, const char* const replace_id);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "log.h"
|
||||
|
||||
void
|
||||
log_init(log_level_t filter, char* log_file)
|
||||
log_init(log_level_t filter, const char* const log_file)
|
||||
{
|
||||
}
|
||||
log_level_t
|
||||
|
||||
@@ -156,6 +156,11 @@ connection_get_profanity_identifier(void)
|
||||
return "profident";
|
||||
}
|
||||
|
||||
void
|
||||
connection_debug_print_features()
|
||||
{
|
||||
}
|
||||
|
||||
jabber_conn_status_t
|
||||
connection_register(const char* const altdomain, int port, const char* const tls_policy,
|
||||
const char* const username, const char* const password)
|
||||
|
||||
Reference in New Issue
Block a user