fix(apk): verdict honnete de la verification, et plus de connexion reutilisee

"unchanged (HTTP 0)" confondait "rien n'a change" et "je n'ai pas pu demander".
Et quand le Wi-Fi se reconnecte avec une autre IP, la pile Java garde des
sockets sur l'interface morte : mesure faite, curl atteint les deux adresses de
GitHub depuis le shell du telephone pendant que l'application expire sur
l'ancienne.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-09-26 13:12:02 +01:00
parent fc7e89a5d5
commit a89e227272
2 changed files with 47 additions and 7 deletions
+41 -7
View File
@@ -3987,10 +3987,26 @@ end;
procedure TForm8.ProbeRemote;
begin
if FBusy or (FUrl = '') or (FToken = '') then Exit;
// JOURNALISE MEME QUAND ELLE NE FAIT RIEN. Une verification muette ne se
// distingue pas d'une verification absente : on ne savait pas si le depot
// avait ete interroge, seulement qu'il n'avait rien dit.
if FBusy or (FUrl = '') or (FToken = '') then
begin
Log('check: skipped (busy or no repository configured)');
Exit;
end;
// Un coffre ne ici n'a pas de depot a interroger.
if HasLocalContainer then Exit;
if FETag = '' then Exit;
if HasLocalContainer then
begin
Log('check: skipped (local vault, no repository)');
Exit;
end;
if FETag = '' then
begin
Log('check: skipped (no fingerprint to compare)');
Exit;
end;
Log('check: asking the repository if it moved');
TThread.CreateAnonymousThread(
procedure
@@ -4006,10 +4022,29 @@ begin
LGet := LClient.Fetch(FETag);
LAhead := (LGet.Status = ssOK) and (LGet.ETag <> '')
and not SameText(LGet.ETag.Trim, FETag.Trim);
// TROIS VERDICTS, PAS DEUX. "Rien n'a change" et "je n'ai pas pu
// demander" se ressemblent - le temoin reste eteint dans les deux
// cas - et le journal les confondait sous "unchanged (HTTP 0)".
TThread.Queue(nil,
procedure
begin
if LAhead then
Log(' it moved - sync to bring it in')
else if LGet.Status in [ssOK, ssNotModified] then
Log(Format(' unchanged (HTTP %d)', [LGet.HttpCode]))
else
Log(Format(' no answer (HTTP %d) %s',
[LGet.HttpCode, LGet.Error]));
end);
except
// Hors reseau : ce n'est pas une nouvelle du depot, c'est une absence
// de nouvelle. Le temoin ne change pas.
Exit;
on E: Exception do
begin
// Hors reseau : ce n'est pas une nouvelle du depot, c'est une
// absence de nouvelle. Le temoin ne change pas, mais le journal le
// dit - sinon rien ne distingue "pas joignable" de "rien change".
TThread.Queue(nil, procedure begin Log(' not reachable'); end);
Exit;
end;
end;
finally
LClient.Free;
@@ -4019,7 +4054,6 @@ begin
procedure
begin
if FRemoteAhead then Exit; // deja dit
Log('remote has moved - sync to bring it in');
SetRemoteAhead(True);
end);
end).Start;