156
156
* Implemented Multi Selective Reject.
157
157
* More efficient generation of SREJ frames.
158
158
* 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.)
159
161
*
160
162
*------------------------------------------------------------------*/
161
163
@@ -591,8 +593,6 @@ static int AX25MODULO(int n, int m, const char *file, const char *func, int line
591
593
592
594
static void dl_data_indication (ax25_dlsm_t * S , int pid , char * data , int len );
593
595
594
- static void lm_seize_confirm (ax25_dlsm_t * S );
595
-
596
596
static void i_frame (ax25_dlsm_t * S , cmdres_t cr , int p , int nr , int ns , int pid , char * info_ptr , int info_len );
597
597
static void i_frame_continued (ax25_dlsm_t * S , int p , int ns , int pid , char * info_ptr , int info_len );
598
598
static 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)
1801
1801
*
1802
1802
* Description: We need to pause the timers when the channel is busy.
1803
1803
*
1804
- * Signal lm_seize_confirm when we have started to transmit.
1805
- *
1806
1804
*------------------------------------------------------------------------------*/
1807
1805
1808
1806
static int dcd_status [MAX_CHANS ];
@@ -1859,14 +1857,6 @@ void lm_channel_busy (dlq_item_t *E)
1859
1857
S -> radio_channel_busy = 1 ;
1860
1858
PAUSE_T1 ;
1861
1859
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
- }
1870
1860
}
1871
1861
else if ( ! busy && S -> radio_channel_busy ) {
1872
1862
S -> radio_channel_busy = 0 ;
@@ -1901,32 +1891,43 @@ void lm_channel_busy (dlq_item_t *E)
1901
1891
*
1902
1892
*------------------------------------------------------------------------------*/
1903
1893
1904
- static void lm_seize_confirm (ax25_dlsm_t * S )
1894
+ void lm_seize_confirm (dlq_item_t * E )
1905
1895
{
1906
1896
1907
- switch ( S -> state ) {
1897
+ assert ( E -> chan >= 0 && E -> chan < MAX_CHANS );
1908
1898
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 ;
1913
1900
1914
- break ;
1901
+ for ( S = list_head ; S != NULL ; S = S -> next ) {
1915
1902
1916
- case state_3_connected :
1917
- case state_4_timer_recovery :
1903
+ if (E -> chan == S -> chan ) {
1918
1904
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.
1923
1905
1924
- i_frame_pop_off_queue ( S );
1906
+ switch ( S -> state ) {
1925
1907
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
+ }
1930
1931
1931
1932
// Implementation difference: The flow chart for state 3 has LM-RELEASE Request here.
1932
1933
// 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)
1935
1936
// Erratum: The original spec had LM-SEIZE request here, for state 4, which didn't seem right.
1936
1937
// The 2006 revision has LM-RELEASE Request so states 3 & 4 are the same.
1937
1938
1938
- break ;
1939
+ break ;
1940
+ }
1941
+ }
1939
1942
}
1940
1943
1941
1944
} /* lm_seize_confirm */
0 commit comments