protocol: Fix case where download can fail for small files.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 18 Aug 2011 18:13:32 +0000 (19:13 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Sun, 28 Aug 2011 08:15:40 +0000 (09:15 +0100)
commit49dc7678bf4bc870c0596c9b76f582a4caef88f8
tree33f4133a9a4e220a3109cce9f1a4618474b56d2c
parent0b5e83cbe55ca61f2394244f75eebad03d4727e9
protocol: Fix case where download can fail for small files.

There is another case where downloads of small files could fail if the
library side (writer) fails.  In this case the library would send back
a cancellation, but it would be received after the daemon had finished
sending the whole file (because the file is small enough).  The daemon
would reenter the main loop and immediately get an unexpected cancel
message, causing the daemon to die.

This commit also makes test-cancellation-download-librarycancels.sh
more robust.  We use Monte-Carlo testing with a range of file sizes.
Small file sizes should trigger the error case.
(cherry picked from commit e4cba8f2b1a68e7361ce342ff659cccb0490446e)
daemon/proto.c
regressions/test-cancellation-download-librarycancels.sh