|author||Chris Wilson <email@example.com>||2014-03-02 08:59:39 +0000|
|committer||Chris Wilson <firstname.lastname@example.org>||2014-03-02 08:59:39 +0000|
Always flush any incoming stream on server side.
Otherwise the protocol might be broken and can't be used any more, even if we made an effort to return an Error reply instead of throwing an exception. This used to not be a problem because an Error reply would terminate the connection anyway, but it no longer does. So if the client also didn't terminate, but tried to handle the exception and keep using the connection, then it might find that its next command fails because the protocol is broken.
Diffstat (limited to 'test')
1 files changed, 13 insertions, 0 deletions
diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp
index 300a666b..8b185f1e 100644
@@ -45,6 +45,7 @@
@@ -1077,6 +1078,18 @@ bool test_server_housekeeping()
TEST_THAT(check_num_files(0, 0, 0, 1));
TEST_THAT(check_num_blocks(protocol, 0, 0, 0, root_dir_blocks, root_dir_blocks));
+ // Used to not consume the stream
+ std::auto_ptr<IOStream> upload(new ZeroStream(1000));
+ 0, /* use for attr hash too */
+ 99999, /* diff from ID */
+ // TODO FIXME replace all other TEST_CHECK_THROWS with TEST_COMMAND_RETURNS_ERROR
// TODO FIXME These tests should not be here, but in
// test_server_commands. But make sure you use a network protocol,
// not a local one, when you move them.