ClientRead: "close" flushes the output buffer
Add a new CommandResult code called "FINISH" which, unlike "CLOSE", will attempt to flush the output buffer. This is a one-shot attempt; it will do one write, and not try again.
This commit is contained in:
parent
422b8472fe
commit
fd2eafa7c6
2
NEWS
2
NEWS
|
@ -1,4 +1,6 @@
|
|||
ver 0.18.2 (2013/??/??)
|
||||
* protocol:
|
||||
- "close" flushes the output buffer
|
||||
* input:
|
||||
- curl: fix bug with redirected streams
|
||||
* playlist:
|
||||
|
|
|
@ -57,6 +57,11 @@ Client::OnSocketInput(void *data, size_t length)
|
|||
main_loop->Break();
|
||||
return InputResult::CLOSED;
|
||||
|
||||
case CommandResult::FINISH:
|
||||
if (Flush())
|
||||
Close();
|
||||
return InputResult::CLOSED;
|
||||
|
||||
case CommandResult::CLOSE:
|
||||
Close();
|
||||
return InputResult::CLOSED;
|
||||
|
|
|
@ -47,6 +47,12 @@ enum class CommandResult {
|
|||
*/
|
||||
ERROR,
|
||||
|
||||
/**
|
||||
* The client has asked MPD to close the connection. MPD will
|
||||
* flush the remaining output buffer first.
|
||||
*/
|
||||
FINISH,
|
||||
|
||||
/**
|
||||
* The connection to this client shall be closed.
|
||||
*/
|
||||
|
|
|
@ -99,7 +99,7 @@ CommandResult
|
|||
handle_close(gcc_unused Client &client,
|
||||
gcc_unused int argc, gcc_unused char *argv[])
|
||||
{
|
||||
return CommandResult::CLOSE;
|
||||
return CommandResult::FINISH;
|
||||
}
|
||||
|
||||
CommandResult
|
||||
|
|
Loading…
Reference in New Issue