improve p2p protocol handling of requested object not available
authorJoey Hess <joeyh@joeyh.name>
Tue, 1 Dec 2020 20:05:55 +0000 (16:05 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 1 Dec 2020 20:05:55 +0000 (16:05 -0400)
commit0540e987b36af281406136ceb89a60434a5374eb
treeb0d8c3798513185a0ebe19af2dc622d1cea3148c
parentca4a928635e631eba189b4f3fa7a7b29a935285f
improve p2p protocol handling of requested object not available

Avoid spurious "verification of content failed" message when downloading
content from a ssh or tor remote fails due to the remote no longer having a
copy of the content.

The P2P protocol already handled this case by sending DATA 0, followed by
VALID. But VALID was not really right, because the data is not the
requested data. So, send DATA 0, followed by INVALID. Old versions of
git-annex handle INVALID the same as VALID in this case. Now new versions
avoid displaying an incorrect message.

It would be better for the P2P protocol to have a different way to indicate
this, like perhaps sending INVALID without DATA. But that would be a
breaking change and need a new protocol verison. Since INVALID already is
part of the protocol and already needs to be handled, using it for this
special case too seems ok, and avoids the complication of another protocol
version.

This commit was sponsored by Jochen Bartl on Patreon.
CHANGELOG
P2P/Annex.hs
P2P/Protocol.hs
doc/bugs/p2p_protocol_misbehavior_when_location_log_out_of_date.mdwn