Skip to content

Lewei: the stop command never reaches the toy #269

Open

Description

@compot-dev

Found by Qodo on #267 and left open for 2.21.0.

What happens: Lewei.Client.run() writes CMD_STOP (command 3) only after its read loop ends normally. A session never ends that way: RtspSession.stop() closes the client and its socket, and any other end is an exception. So the write is not reached, and the toy learns that the session is over only from the TCP close. docs/toys.md lists command 3 as the one that ends the stream.

Why it was not fixed in #267: the current behaviour is the one checked on a real VISUO drone in #262, where video plays. It has not been checked how the toy behaves on a quick stop and start.

The catch in the fix: close() cannot just write the command, because stop() may run on the UI thread. If close() only sets a flag, run() sends the command and closes the socket itself, up to one read tick (200 ms) later. By then a new session may have started, so a late stop from the old connection could end the new stream. Whether it does depends on the toy.

To find out, with a toy or a report

  1. Does restarting a slot quickly ever fail or take long without the stop command? If not, removing the unreachable write and correcting the docs may be enough.
  2. If it does, does a stop on the old connection affect a stream already started on a new one?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions