proto: Fix for rare FileIn hangs. (RHBZ#969845).

Yet another protocol bug!

If the daemon cancels, then the library should send a cancellation
chunk.  It normally does this during the loop where it is uploading a
file.  However due to an oversight or possibly a regression when we
modularized the socket code, the library did not send a cancellation
chunk if the daemon cancelled just before the end of file was sent.

This commit fixes this.
This commit is contained in:
Richard W.M. Jones
2013-06-02 18:52:44 +01:00
parent 1c9dfd079a
commit 697b0f89fe

View File

@@ -376,7 +376,14 @@ guestfs___send_file (guestfs_h *g, const char *filename)
return -1;
}
return send_file_complete (g);
err = send_file_complete (g);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */
send_file_cancellation (g);
return err;
}
return 0;
}
/* Send a chunk of file data. */