misc: fix crash using tracedump plugin with socket API clients

Type: fix
Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Change-Id: I208724a515c9a38c4032f101bdf73aa87b1c13be
This commit is contained in:
Arthur de Kerhor
2022-12-22 19:48:05 +01:00
parent 413447451e
commit b89db0cf75

View File

@ -213,12 +213,15 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp)
iterator_position = clib_net_to_host_u32 (mp->position);
max_records = clib_net_to_host_u32 (mp->max_records);
/* Don't overflow the existing queue space. */
svm_queue_t *q = rp->vl_input_queue;
u32 queue_slots_available = q->maxsize - q->cursize;
int chunk = (queue_slots_available > 0) ? queue_slots_available - 1 : 0;
if (chunk < max_records)
max_records = chunk;
/* Don't overflow the existing queue space for shared memory API clients. */
if (rp->vl_input_queue)
{
svm_queue_t *q = rp->vl_input_queue;
u32 queue_slots_available = q->maxsize - q->cursize;
int chunk = (queue_slots_available > 0) ? queue_slots_available - 1 : 0;
if (chunk < max_records)
max_records = chunk;
}
/* Need a fresh cache for this client? */
if (vec_len (client_trace_cache) == 0