Fix: ctf: notif-iter: do not call request_medium_bytes() when not needed
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 4 Oct 2017 00:10:17 +0000 (20:10 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Nov 2017 19:51:43 +0000 (15:51 -0400)
commitdf0139b8dec30ef11734f92977a5e02f7caeb5bb
treefe1cead6675afcb2cbec61f34987d4da0e51b063
parent4cd687b91119934bf7746e86491c4d46a9c676bd
Fix: ctf: notif-iter: do not call request_medium_bytes() when not needed

Do not systematically call request_medium_bytes(), that is, at the
beginning of read_dscope_begin_state(), because the scope field which is
about to be decoded might be empty, an already aligned structure
field or the equivalent (through a variant field for example, of which
the tag is outside this scope).

To do this we also need to make bt_btr_start() accept a size of 0. In
this case, if the field to decode is an empty structure which is already
aligned, then bt_btr_start() does not need to consume any bit and
returns BT_BTR_STATUS_OK with 0 consumed bits. In this case, the next
notif-iter state is not a continuing state, thus request_medium_bytes()
is not called yet.

Checking for a bad state when request_medium_bytes() receives
BT_NOTIF_ITER_MEDIUM_STATUS_EOF from the medium is easier. Good states
are:

* If the current packet size is set:
** Current packet offset is current packet size.
* Otherwise:
** Current packet offset is 0.
** Last event header offset is set and current offset is equal to it.

All other states are invalid.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/common/btr/btr.c
plugins/ctf/common/notif-iter/notif-iter.c
This page took 0.025014 seconds and 4 git commands to generate.