The source project of this merge request has been removed.
TInetSocket connect timeout support under 1 second fix.
Summary
The TInetSocket's CheckSocketConnectTimeout function has the microseconds field (tv_usec) of locTimeVal (PTimeVal) variable always zero.
What is the current bug behavior?
Cannot set connect timeout smaller than 1 second ( 1000 milliseconds ) .
What is the behavior after applying this patch?
Values down to 1 millisecond can be set to connect timeout.
Relevant logs and/or screenshots
// Return true if a timeout happened. Will only be called in case of eWouldBlock.
function TInetSocket.CheckSocketConnectTimeout(ASocket: cint; AFDSPtr: Pointer; ATimeVPtr: Pointer): TCheckTimeoutResult;
var
Err,ErrLen : Longint;
Res : LongInt;
locTimeVal: PTimeVal;
locFDS: PFDSet;
begin
locTimeVal := PTimeVal(ATimeVPtr);
locFDS := PFDSet(AFDSPtr);
locTimeVal^.tv_usec := 0; --> changed to (FConnectTimeout mod 1000) * 1000;
locTimeVal^.tv_sec := FConnectTimeout div 1000;
Edited by d.ioannidis