Fix BinkP inbound bidirectional: scan BSO outbound on M_ADR

BinkP answerer now scans BSO outbound for all remote AKAs when
receiving M_ADR, queuing any pending files for send-back. Previously
BinkpRunInbound had an empty send queue — it could only receive.

Same pattern as the Comet inbound bidir fix in cometdaemon.pas.

Tested: BinkP bidir multi-file (2 sent + 2 received) over internet,
ED25519 authenticated, all M_GOT confirmed.
This commit is contained in:
2026-04-01 14:59:02 -07:00
parent 8a23f63f66
commit 42eb79aad8

View File

@@ -295,9 +295,11 @@ var
CmdID: Byte;
Arg, Pwd, AddrStr: string;
Parts, FParts: TStringList;
I, AtPos, AKAIdx: Integer;
I, J, AtPos, AKAIdx: Integer;
Addr: TCometAddress;
FinalPath: string;
Flav: TCometFlavour;
PktPath, FloPath, FinalPath: string;
FloEntries: TCometFloEntryArray;
TF: file;
Challenge: TBytes;
CRAMResponse: string;
@@ -479,6 +481,57 @@ begin
LogInfo('BinkP remote: %s (%s)',
[CometAddrToStr(S.RemoteAddrs[0]), S.RemoteSysName]);
{ Answerer: scan BSO outbound for files to send to the caller.
Same pattern as Comet inbound — scan all remote AKAs. }
if (not S.IsOriginator) and (Length(S.RemoteAddrs) > 0) and
(S.SendQueueLen = 0) then
begin
for I := 0 to High(S.RemoteAddrs) do
begin
if S.RemoteAddrs[I].Net = 0 then Continue;
for Flav := Low(TCometFlavour) to High(TCometFlavour) do
begin
if Flav = cfHold then Continue;
PktPath := BSONodeFile(S.Cfg.Outbound,
S.RemoteAddrs[I], S.Cfg.Addresses[0].Zone,
BSOPktExt(Flav));
if CometFileExists(PktPath) then
begin
if S.SendQueueLen >= Length(S.SendQueue) then
SetLength(S.SendQueue, S.SendQueueLen + 16);
FillChar(S.SendQueue[S.SendQueueLen], SizeOf(TBinkpSendEntry), 0);
S.SendQueue[S.SendQueueLen].FilePath := PktPath;
S.SendQueue[S.SendQueueLen].Action := csaDelete;
Inc(S.SendQueueLen);
end;
FloPath := BSONodeFile(S.Cfg.Outbound,
S.RemoteAddrs[I], S.Cfg.Addresses[0].Zone,
BSOFloExt(Flav));
if CometFileExists(FloPath) then
begin
FloEntries := BSOReadFlo(FloPath);
for J := 0 to High(FloEntries) do
begin
if FloEntries[J].Sent then Continue;
if (FloEntries[J].FilePath = '') or
not FileExists(FloEntries[J].FilePath) then Continue;
if S.SendQueueLen >= Length(S.SendQueue) then
SetLength(S.SendQueue, S.SendQueueLen + 16);
FillChar(S.SendQueue[S.SendQueueLen], SizeOf(TBinkpSendEntry), 0);
S.SendQueue[S.SendQueueLen].FilePath := FloEntries[J].FilePath;
S.SendQueue[S.SendQueueLen].FloPath := FloPath;
S.SendQueue[S.SendQueueLen].FloLine := FloEntries[J].OrigPath;
S.SendQueue[S.SendQueueLen].Action := FloEntries[J].Action;
Inc(S.SendQueueLen);
end;
end;
end;
end;
if S.SendQueueLen > 0 then
LogInfo('BinkP inbound: queued %d files for %s',
[S.SendQueueLen, CometAddrToStr(S.RemoteAddrs[0])]);
end;
{ Originator: send password after receiving ADR.
Use CRAM-MD5 if remote offered a challenge in OPT,
otherwise send plain password per FTS-1026. }