Ticket #9922 (closed Patch - Bug Fix: fixed)
Opened 23 months ago
Last modified 22 months ago
Frontend network control sends two responses after 'play program'
|Reported by:||Gregory Moyer <moyerg@…>||Owned by:||wagnerrp|
|Component:||MythTV - General||Version:||Master Head|
My patch for #9725 overlooked the fact that the 'play program' command was relying on empty responses not being sent to the client.
In the processPlay method in networkcontrol.cpp for a 'play program' command, the result string is cleared when the NETWORK_CONTROL event to actually trigger playback is sent. Before the patch, when this function returned with an empty result, no message would have been sent back to the client and the client would still be waiting at this point. Once the playback request is received, networkcontrol.cpp will see a NETWORK_CONTROL RESPONSE event in the function customEvent and that will trigger the "OK" response to the client. This is the only place I found in which the result is cleared while a response is expected via an event later.
Now, after the fix from #9725, the empty response sends a prompt back to the user immediately and a short time later when the RESPONSE event is received, a second message of "OK" with another prompt is sent to the user. Therefore, in a netcat session, the user seems something like the attached nc-broken.log output.
My approach to correct this involves setting the response to a null QString (as QString defines null using the no-arg constructor) rather than an empty string when no response should be sent. Instead of checking for an empty string, the if check that was removed in #9725 is now verifying that the response is not null. This allows for both scenarios where an empty message can be returned to the user (such as when a 'query recordings' command is issued and no recordings exist), but an immediate response can also be stopped to allow for a delayed response triggered via other means, such as an event in the case of a 'play program' request.
This patch also changes the default response to 'query recordings' to a an empty string instead of a null string to comply with the above.
Changed 23 months ago by Gregory Moyer <moyerg@…>
comment:1 Changed 22 months ago by wagnerrp
- Owner set to wagnerrp
- Status changed from new to accepted
comment:2 Changed 22 months ago by Github
- Status changed from accepted to closed
- Resolution set to fixed
- Milestone changed from unknown to 0.25