mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 20:09:23 +02:00
* don't execute DoBeforeDataRead unless OnIdle is set
This commit is contained in:
parent
35c45dfbe5
commit
ae0cf1b50f
@ -136,7 +136,7 @@ Type
|
|||||||
// Called before data is read.
|
// Called before data is read.
|
||||||
Procedure DoBeforeDataRead; virtual;
|
Procedure DoBeforeDataRead; virtual;
|
||||||
// Called when the client is waiting for the server.
|
// Called when the client is waiting for the server.
|
||||||
Procedure DoOnIdle; virtual;
|
Procedure DoOnIdle;
|
||||||
// Called whenever data is read.
|
// Called whenever data is read.
|
||||||
Procedure DoDataRead; virtual;
|
Procedure DoDataRead; virtual;
|
||||||
// Called whenever data is written.
|
// Called whenever data is written.
|
||||||
@ -704,7 +704,10 @@ procedure TFPCustomHTTPClient.DoBeforeDataRead;
|
|||||||
var
|
var
|
||||||
BreakUTC: TDateTime;
|
BreakUTC: TDateTime;
|
||||||
begin
|
begin
|
||||||
// use CanRead to keep the client responsive in case the server needs a lot of time to respond
|
// Use CanRead to keep the client responsive in case the server needs a lot of time to respond.
|
||||||
|
// The request can be terminated in OnIdle - therefore it makes sense only if FOnIdle is set
|
||||||
|
If not Assigned(FOnIdle) Then
|
||||||
|
Exit;
|
||||||
if IOTimeout>0 then
|
if IOTimeout>0 then
|
||||||
BreakUTC := IncMilliSecond(NowUTC, IOTimeout);
|
BreakUTC := IncMilliSecond(NowUTC, IOTimeout);
|
||||||
while not Terminated and not FSocket.CanRead(10) and (FSocket.LastError=0) do
|
while not Terminated and not FSocket.CanRead(10) and (FSocket.LastError=0) do
|
||||||
|
Loading…
Reference in New Issue
Block a user