Send less ACK requests
Only send an `r` stanza after we've received the reply to the previous one. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
@@ -181,6 +181,7 @@ struct _xmpp_sm_t {
|
||||
int sm_support;
|
||||
int sm_enabled;
|
||||
int can_resume, resume, dont_request_resume;
|
||||
int r_sent;
|
||||
uint32_t sm_handled_nr;
|
||||
uint32_t sm_sent_nr;
|
||||
xmpp_queue_t sm_queue;
|
||||
|
||||
@@ -1314,7 +1314,7 @@ static void _reset_sm_state_for_reconnect(xmpp_conn_t *conn)
|
||||
s->id = NULL;
|
||||
}
|
||||
|
||||
s->sm_enabled = s->sm_support = s->resume = 0;
|
||||
s->r_sent = s->sm_enabled = s->sm_support = s->resume = 0;
|
||||
|
||||
if (s->bind) {
|
||||
xmpp_stanza_release(s->bind);
|
||||
@@ -1751,6 +1751,7 @@ static void _conn_sm_handle_stanza(xmpp_conn_t *const conn,
|
||||
c = queue_element_free(conn->ctx, e);
|
||||
strophe_free(conn->ctx, c);
|
||||
}
|
||||
conn->sm_state->r_sent = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2035,8 +2036,10 @@ static int _send_raw(xmpp_conn_t *conn,
|
||||
conn->send_queue_user_len++;
|
||||
strophe_debug_verbose(3, conn->ctx, "conn", "QUEUED: %s", data);
|
||||
strophe_debug_verbose(1, conn->ctx, "conn", "Q_ADD: %p", item);
|
||||
if (!(owner & XMPP_QUEUE_SM) && conn->sm_state->sm_enabled) {
|
||||
if (!(owner & XMPP_QUEUE_SM) && conn->sm_state->sm_enabled &&
|
||||
!conn->sm_state->r_sent) {
|
||||
send_raw(conn, req_ack, strlen(req_ack), XMPP_QUEUE_SM_STROPHE, item);
|
||||
conn->sm_state->r_sent = 1;
|
||||
}
|
||||
return XMPP_EOK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user