logging/nxscope: do not complete the stream frame if the previous send failed

In this case, the buffer already contains a frame ready to be send
This commit is contained in:
raiden00pl 2023-05-13 09:59:16 +02:00 committed by Alan Carvalho de Assis
parent 8726e530d5
commit 5eebfbb441
2 changed files with 14 additions and 5 deletions

View File

@ -360,6 +360,7 @@ struct nxscope_s
FAR uint8_t *streambuf; FAR uint8_t *streambuf;
size_t streambuf_len; size_t streambuf_len;
size_t stream_i; size_t stream_i;
bool stream_retry;
#ifdef CONFIG_LOGGING_NXSCOPE_CRICHANNELS #ifdef CONFIG_LOGGING_NXSCOPE_CRICHANNELS
/* Critical buffer data */ /* Critical buffer data */

View File

@ -61,6 +61,8 @@ int nxscope_stream_send(FAR struct nxscope_s *s, FAR uint8_t *buff,
/* Finalize stream frame */ /* Finalize stream frame */
if (!s->stream_retry)
{
ret = PROTO_FRAME_FINAL(s, s->proto_stream, ret = PROTO_FRAME_FINAL(s, s->proto_stream,
NXSCOPE_HDRID_STREAM, buff, buff_i); NXSCOPE_HDRID_STREAM, buff, buff_i);
if (ret < 0) if (ret < 0)
@ -68,6 +70,7 @@ int nxscope_stream_send(FAR struct nxscope_s *s, FAR uint8_t *buff,
_err("ERROR: PROTO_FRAME_FINAL failed %d\n", ret); _err("ERROR: PROTO_FRAME_FINAL failed %d\n", ret);
goto errout; goto errout;
} }
}
/* Send stream data */ /* Send stream data */
@ -75,6 +78,11 @@ int nxscope_stream_send(FAR struct nxscope_s *s, FAR uint8_t *buff,
if (ret < 0) if (ret < 0)
{ {
_err("ERROR: INTF_SEND failed %d\n", ret); _err("ERROR: INTF_SEND failed %d\n", ret);
s->stream_retry = true;
}
else
{
s->stream_retry = false;
} }
errout: errout: