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.
This commit is contained in:
Joey Hess 2020-12-01 16:05:55 -04:00
parent ca4a928635
commit 0540e987b3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 22 additions and 2 deletions

View file

@ -35,9 +35,16 @@ closes the connection, the next move fails when it should not need to.
> to avoid needing to add to the protocol. That should avoid
> the spurious "verification of content failed".
>
> > Done and it did.
>
> But what causes the connection to get closed? It seems that
> while the server sends VALID, the client never debugs that it received
> it. Indeeed, the receiveMessage call that should receive it
> fails because the handle is closed at that point. Seems that
> this is caused by trying to receive 0 bytes as indicated by DATA
> ending up closing the handle.
> ending up closing the handle. Another case of it involved getting
> an empty file followed by a second file.
>
> > This bug is fixed.
[[done]] --[[Joey]]