Linux MS/TP Fixes (#1051)
* Linux MS/TP: * dlmstp_init: * Maximize thread priority if permitted * MSTP_Put_Receive/dlmstp_receive: * Use a buffer so incoming frames are not dropped during bursts * dlmstp_receive: * Make timeout optional * MSTP_Get_Reply: * Lock the mutex before using the PDU Queue * Iterate over all queued replies to find a match (instead of only checking the first) * Sleep for a millisecond before checking again to wait for the application provide a reply * RS485_Check_UART_Data: * Ensure waiter is initilized before using with select * Ensure bytes are read before adding to FIFO TSM: * Add log when `datalink_send_pdu` fails for consistency with all other `datalink_send_pdu` calls dlenv_maintenance_timer: * Fix Tx/Rx labels in MSTP statitistics print * don't log on queued requests
This commit is contained in:
@@ -299,6 +299,7 @@ bool tsm_get_transaction_pdu(
|
||||
void tsm_timer_milliseconds(uint16_t milliseconds)
|
||||
{
|
||||
unsigned i = 0; /* counter */
|
||||
int bytes_sent = 0;
|
||||
|
||||
BACNET_TSM_DATA *plist = &TSM_List[0];
|
||||
|
||||
@@ -314,13 +315,16 @@ void tsm_timer_milliseconds(uint16_t milliseconds)
|
||||
if (plist->RetryCount < apdu_retries()) {
|
||||
plist->RequestTimer = apdu_timeout();
|
||||
plist->RetryCount++;
|
||||
datalink_send_pdu(
|
||||
bytes_sent = datalink_send_pdu(
|
||||
&plist->dest, &plist->npdu_data, &plist->apdu[0],
|
||||
plist->apdu_len);
|
||||
DEBUG_PRINTF(
|
||||
"invoke-id[%u] Retry %u of %u after %ums\n",
|
||||
plist->InvokeID, plist->RetryCount, apdu_retries(),
|
||||
plist->RequestTimer);
|
||||
if (bytes_sent <= 0) {
|
||||
debug_perror("invoke-id[%u] Failed to Send Retry");
|
||||
}
|
||||
} else {
|
||||
/* note: the invoke id has not been cleared yet
|
||||
and this indicates a failed message:
|
||||
|
||||
Reference in New Issue
Block a user