156156 * Implemented Multi Selective Reject.
157157 * More efficient generation of SREJ frames.
158158 * Reduced number of duplicate I frames sent for both REJ and SREJ cases.
159+ * Avoided unnecessary RR when I frame could take care of the ack.
160+ * (This led to issue 132 where outgoing data sometimes got stuck in the queue.)
159161 *
160162 *------------------------------------------------------------------*/
161163
@@ -591,8 +593,6 @@ static int AX25MODULO(int n, int m, const char *file, const char *func, int line
591593
592594static void dl_data_indication (ax25_dlsm_t * S , int pid , char * data , int len );
593595
594- static void lm_seize_confirm (ax25_dlsm_t * S );
595-
596596static void i_frame (ax25_dlsm_t * S , cmdres_t cr , int p , int nr , int ns , int pid , char * info_ptr , int info_len );
597597static void i_frame_continued (ax25_dlsm_t * S , int p , int ns , int pid , char * info_ptr , int info_len );
598598static int is_ns_in_window (ax25_dlsm_t * S , int ns );
@@ -1801,8 +1801,6 @@ static void dl_data_indication (ax25_dlsm_t *S, int pid, char *data, int len)
18011801 *
18021802 * Description: We need to pause the timers when the channel is busy.
18031803 *
1804- * Signal lm_seize_confirm when we have started to transmit.
1805- *
18061804 *------------------------------------------------------------------------------*/
18071805
18081806static int dcd_status [MAX_CHANS ];
@@ -1859,14 +1857,6 @@ void lm_channel_busy (dlq_item_t *E)
18591857 S -> radio_channel_busy = 1 ;
18601858 PAUSE_T1 ;
18611859 PAUSE_TM201 ;
1862-
1863- // Did channel become busy due to PTT turning on?
1864-
1865- if ( E -> activity == OCTYPE_PTT && E -> status == 1 ) {
1866-
1867- lm_seize_confirm (S ); // C4.2. "This primitive indicates, to the Data-link State
1868- // machine, that the transmission opportunity has arrived."
1869- }
18701860 }
18711861 else if ( ! busy && S -> radio_channel_busy ) {
18721862 S -> radio_channel_busy = 0 ;
@@ -1901,32 +1891,43 @@ void lm_channel_busy (dlq_item_t *E)
19011891 *
19021892 *------------------------------------------------------------------------------*/
19031893
1904- static void lm_seize_confirm (ax25_dlsm_t * S )
1894+ void lm_seize_confirm (dlq_item_t * E )
19051895{
19061896
1907- switch ( S -> state ) {
1897+ assert ( E -> chan >= 0 && E -> chan < MAX_CHANS );
19081898
1909- case state_0_disconnected :
1910- case state_1_awaiting_connection :
1911- case state_2_awaiting_release :
1912- case state_5_awaiting_v22_connection :
1899+ ax25_dlsm_t * S ;
19131900
1914- break ;
1901+ for ( S = list_head ; S != NULL ; S = S -> next ) {
19151902
1916- case state_3_connected :
1917- case state_4_timer_recovery :
1903+ if (E -> chan == S -> chan ) {
19181904
1919- // v1.5 change in strategy.
1920- // New I frames, not sent yet, are delayed until after processing anything in the received transmission.
1921- // Previously we started sending new frames, from the client app, as soon as they arrived.
1922- // Now, we first take care of those in progress before throwing more into the mix.
19231905
1924- i_frame_pop_off_queue ( S );
1906+ switch ( S -> state ) {
19251907
1926- if (S -> acknowledge_pending ) {
1927- S -> acknowledge_pending = 0 ;
1928- enquiry_response (S , frame_not_AX25 , 0 );
1929- }
1908+ case state_0_disconnected :
1909+ case state_1_awaiting_connection :
1910+ case state_2_awaiting_release :
1911+ case state_5_awaiting_v22_connection :
1912+
1913+ break ;
1914+
1915+ case state_3_connected :
1916+ case state_4_timer_recovery :
1917+
1918+ // v1.5 change in strategy.
1919+ // New I frames, not sent yet, are delayed until after processing anything in the received transmission.
1920+ // Previously we started sending new frames, from the client app, as soon as they arrived.
1921+ // Now, we first take care of those in progress before throwing more into the mix.
1922+
1923+ i_frame_pop_off_queue (S );
1924+
1925+ // Need an RR if we didn't have I frame send the necessary ack.
1926+
1927+ if (S -> acknowledge_pending ) {
1928+ S -> acknowledge_pending = 0 ;
1929+ enquiry_response (S , frame_not_AX25 , 0 );
1930+ }
19301931
19311932// Implementation difference: The flow chart for state 3 has LM-RELEASE Request here.
19321933// I don't think I need it because the transmitter will turn off
@@ -1935,7 +1936,9 @@ static void lm_seize_confirm (ax25_dlsm_t *S)
19351936// Erratum: The original spec had LM-SEIZE request here, for state 4, which didn't seem right.
19361937// The 2006 revision has LM-RELEASE Request so states 3 & 4 are the same.
19371938
1938- break ;
1939+ break ;
1940+ }
1941+ }
19391942 }
19401943
19411944} /* lm_seize_confirm */
0 commit comments