You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* In the case of the message buffer, one has to be able to write the complete message as opposed to
540
-
* a stream buffer for semantic reasons. Check if it is physically possible to write the message given
541
-
* the length of the buffer. */
535
+
/* If this is a message buffer then it must be possible to write the
536
+
* whole message. */
542
537
if( xRequiredSpace>pxStreamBuffer->xLength )
543
538
{
544
-
/* The message could never be written because it is greater than the buffer length.
545
-
* By setting xIsFeasable to FALSE, we skip over the following do..while loop, thus avoiding
546
-
* a deadlock. The call to 'prvWriteMessageToBuffer' toward the end of this function with
547
-
* xRequiredSpace greater than xSpace will suffice in not writing anything to the internal buffer.
548
-
* Now, the function will return 0 because the message could not be written. Should an error code be
549
-
* returned instead ??? In my opinion, probably.. But the return type doesn't allow for negative
550
-
* values to be returned. A confusion could exist to the caller. Returning 0 because a timeout occurred
551
-
* and a subsequent send attempts could eventually succeed, and returning 0 because a write could never
552
-
* happen because of the size are two scenarios to me :/ */
553
-
xIsFeasible=pdFALSE;
539
+
/* The message would not fit even if the entire buffer was empty,
540
+
* so don't wait for space. */
541
+
xTicksToWait= ( TickType_t ) 0;
554
542
}
555
543
else
556
544
{
557
-
/* It is possible to write the message completely in the buffer. This is the intended route.
558
-
* Let's continue with the regular timeout logic. */
559
-
xIsFeasible=pdTRUE;
545
+
mtCOVERAGE_TEST_MARKER();
560
546
}
561
547
}
562
548
else
563
549
{
564
-
/* In the case of the stream buffer, not being able to completely write the message in the buffer
565
-
* is an acceptable scenario, but it has to be dealt with properly */
550
+
/* If this is a stream buffer then it is acceptable to write only part
551
+
* of the message to the buffer. Cap the length to the total length of
552
+
* the buffer. */
566
553
if( xRequiredSpace>pxStreamBuffer->xLength )
567
554
{
568
-
/* Not enough buffer space. We will attempt to write as much as we can in this run
569
-
* so that the caller can send the remaining in subsequent calls. We avoid a deadlock by
570
-
* offering the possibility to take the 'else' branch in the 'if( xSpace < xRequiredSpace )'
571
-
* condition inside the following do..while loop */
572
555
xRequiredSpace=pxStreamBuffer->xLength;
573
-
574
-
/* TODO FIXME: Is there a check we should do with the xTriggerLevelBytes value ? */
575
-
576
-
/* With the adjustment to 'xRequiredSpace', the deadlock is avoided, thus it's now feasible. */
577
-
xIsFeasible=pdTRUE;
578
556
}
579
557
else
580
558
{
581
-
/* It is possible to write the message completely in the buffer. */
582
-
xIsFeasible=pdTRUE;
559
+
mtCOVERAGE_TEST_MARKER();
583
560
}
584
561
}
585
562
586
-
/* Added check against xIsFeasible. If it's not feasible, don't even wait for notification, let the call to 'prvWriteMessageToBuffer' do nothing and return 0 */
0 commit comments