Hi,

In thread mode, the DoRequestSync of httpcli and sslhttpcli will spend more 
than 1000ms to wait for the http state chage, i think the reason is the 
MsgWaitForMultipleObjects dont get QS_ALLINPUT event in thread mode,
I changed the code as below, MsgWaitForMultipleObjects will be triggered every 
10ms in thread mode, but i dont know whether it's good or not, so could you 
improve it?

procedure THttpCli.DoRequestSync(Rq : THttpRequest);  { V7.04 Timeout added }
var
    TimeOutMsec     : UINT;
    bFlag           : Boolean;
    dwWaitMs        : DWORD;
begin
    DoRequestAsync(Rq);
    if not Assigned(FCtrlSocket.Counter) then
        FCtrlSocket.CreateCounter;
    FCtrlSocket.Counter.LastSendTick := IcsGetTickCount; // Reset counter
    if FMultiThreaded then
       dwWaitMs:= 10 else
       dwWaitMs:= 1000;
    TimeOutMsec := FTimeOut * 1000;
    while FState <> httpReady do begin
      {$IFDEF MSWINDOWS}
        if MsgWaitForMultipleObjects(0, Pointer(nil)^, FALSE, dwWaitMs,
                                     QS_ALLINPUT) = WAIT_OBJECT_0 then
      {$ENDIF}


Regards.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to