virtual-device: Remove messages we can't process from queue when not scanning

Commands that are not valid for non-scan operations should be removed
from queue, or these may be re-proposed forever.
This commit is contained in:
Marco Trevisan (Treviño) 2021-01-28 00:54:34 +01:00
parent c495b82000
commit e1e3f6955e
2 changed files with 11 additions and 1 deletions

View file

@ -164,7 +164,11 @@ process_cmds (FpDeviceVirtualDevice * self,
/* If we are not scanning, then we have to stop here. */
if (!scan)
break;
{
g_warning ("Could not process command: %s", cmd);
g_ptr_array_remove_index (self->pending_commands, 0);
break;
}
if (g_str_has_prefix (cmd, SCAN_CMD_PREFIX))
{

View file

@ -556,6 +556,12 @@ class VirtualDevice(unittest.TestCase):
self.assertFalse(self._verify_completed)
self.cancel_verify()
# Since we don't really cancel here, next command will be passed to release
self._close_on_teardown = False
with GLibErrorMessage('libfprint-virtual_device',
GLib.LogLevelFlags.LEVEL_WARNING, 'Could not process command: SCAN *'):
self.dev.close_sync()
def test_device_sleep_before_completing_verify(self):
enrolled = self.enroll_print('foo-print', FPrint.Finger.LEFT_RING)