From 1cb82932afe865908badb3b4f989a8887609ef08 Mon Sep 17 00:00:00 2001 From: tkummermehr Date: Thu, 13 Jul 2017 18:06:16 +0200 Subject: Fixed crash of TX CDEV write, when there was many traffic --- ucs2-afb/ucs_binding.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'ucs2-afb') diff --git a/ucs2-afb/ucs_binding.c b/ucs2-afb/ucs_binding.c index c1a0a06..c680ecb 100644 --- a/ucs2-afb/ucs_binding.c +++ b/ucs2-afb/ucs_binding.c @@ -154,15 +154,13 @@ PUBLIC void UCSI_CB_OnMostError(void *pTag, uint16_t sourceAddr, -// Callback when ever this instance wants to send a message to INIC. -// BUGS?? Sample was returning true/false on error when integration layer expect a void [question from Fulup to Thorsten] +/* Callback when ever this UNICENS wants to send a message to INIC. */ PUBLIC void UCSI_CB_SendMostMessage(void *pTag, const uint8_t *pData, uint32_t len) { ucsContextT *ucsContext = (ucsContextT*) pTag; CdevData_t *cdevTx = &ucsContext->tx; uint32_t total = 0; - if (NULL == pData || 0 == len) return; if (O_RDONLY == cdevTx->fileFlags) return; @@ -175,13 +173,11 @@ PUBLIC void UCSI_CB_SendMostMessage(void *pTag, const uint8_t *pData, uint32_t l ssize_t written = write(cdevTx->fileHandle, &pData[total], (len - total)); if (0 >= written) { - cdevTx->fileHandle = -1; - return; + /* Silently ignore write error (only occur in non-blocking mode) */ + break; } total += (uint32_t) written; } - - return; } /** -- cgit 1.2.3-korg