@@ -1359,13 +1359,18 @@ static int _get_h_attribute(xmpp_stanza_t *stanza, unsigned long *ul_h)
13591359 return 0 ;
13601360}
13611361
1362- static void _sm_queue_cleanup (xmpp_conn_t * conn , unsigned long ul_h )
1362+ static void _sm_queue_cleanup (xmpp_conn_t * conn , unsigned long ul_h , int failed )
13631363{
13641364 xmpp_send_queue_t * e ;
13651365 while ((e = peek_queue_front (& conn -> sm_state -> sm_queue ))) {
13661366 if (e -> sm_h >= ul_h )
13671367 break ;
13681368 e = pop_queue_front (& conn -> sm_state -> sm_queue );
1369+ if (failed && conn -> sm_fail_callback && e -> id ) {
1370+ conn -> sm_fail_callback (conn , conn -> sm_fail_callback_ctx , e -> id );
1371+ } else if (conn -> sm_ack_callback && e -> id ) {
1372+ conn -> sm_ack_callback (conn , conn -> sm_ack_callback_ctx , e -> id );
1373+ }
13691374 strophe_free (conn -> ctx , queue_element_free (conn -> ctx , e ));
13701375 }
13711376}
@@ -1441,7 +1446,7 @@ static int _handle_sm(xmpp_conn_t *const conn,
14411446 conn -> sm_state -> sm_sent_nr = conn -> sm_state -> sm_queue .head -> sm_h ;
14421447 else
14431448 conn -> sm_state -> sm_sent_nr = ul_h ;
1444- _sm_queue_cleanup (conn , ul_h );
1449+ _sm_queue_cleanup (conn , ul_h , 0 );
14451450 _sm_queue_resend (conn );
14461451 strophe_debug (conn -> ctx , "xmpp" , "Session resumed successfully." );
14471452 _stream_negotiation_success (conn );
@@ -1468,7 +1473,7 @@ static int _handle_sm(xmpp_conn_t *const conn,
14681473 /* In cases there's no `h` included, drop all elements. */
14691474 ul_h = (unsigned long )-1 ;
14701475 }
1471- _sm_queue_cleanup (conn , ul_h );
1476+ _sm_queue_cleanup (conn , ul_h , 1 );
14721477 }
14731478 } else if (!strcmp (cause , "feature-not-implemented" )) {
14741479 conn -> sm_state -> resume = 0 ;
0 commit comments