aboutsummaryrefslogtreecommitdiffstats
path: root/ucs2-afb
diff options
context:
space:
mode:
authortkummermehr <thorsten.kummermehr@k2l.de>2017-07-13 18:06:16 +0200
committertkummermehr <thorsten.kummermehr@k2l.de>2017-07-13 18:06:16 +0200
commit1cb82932afe865908badb3b4f989a8887609ef08 (patch)
treeace13cd3d96c5cc93b09bb4c14c98bd50744f632 /ucs2-afb
parent4b64b8ea3d055bf3b1af751b399b3a9e1d0baa2b (diff)
Fixed crash of TX CDEV write, when there was many traffic
Diffstat (limited to 'ucs2-afb')
-rw-r--r--ucs2-afb/ucs_binding.c10
1 files changed, 3 insertions, 7 deletions
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;
}
/**