Hello,

We want to reuse THttpCli after a request ends (either aborted or
normal) in a MR HTTP reverse proxy. We also want to reuse non-aborted
sockets so as to keep the socket open in another repository thread.
Here is my logic:

I first override,

void __fastcall httpClient::StateChange(THttpState NewState)
{
        if(!httpServerClient || httpServerClient->skipHTTPClientEvents)
                int tester = 10;
        else
                THttpCli::StateChange(NewState);
}
//---------------------------------------------------------------------------
void __fastcall httpClient::SetReady()
{
        if(!httpServerClient || httpServerClient->beganDetach ||
httpServerClient->responseEnded)
                StateChange(httpReady);
        else
                THttpCli::SetReady();
}
//---------------------------------------------------------------------------
void __fastcall httpClient::TriggerRequestDone()
{
        if(!httpServerClient || httpServerClient->beganDetach ||
httpServerClient->responseEnded)
        {
                if(FOnRequestDone)
                        THttpCli::FOnRequestDone(this, FRequestType, 
FRequestDoneError);
        }
        else
                THttpCli::TriggerRequestDone();
}
//---------------------------------------------------------------------------

so that no more messages post after ThreadDetach();.

Then I check for whether THttpCli is aborted. If it is aborted, I
check if it is still connected (HTTPClient->Connected). If so, I
simply delay ThreadDetach until OnSessionClosed. If not I simply
abort(); and then ThreadDetach().

Now the problem is THttpCli is so much unstable in closing, it acts
very unpredictably! When I reattach in another client, I mostly see it
is not really threaddetach'ed! (That is after threaddetach, GetHandle
is called somewhere) or sometimes the delayed threaddetach does not
work.

Francois, we would be happy to pay you the 70Euros/hr for 2 hours if
you could write a stable reuse routine for THttpCli (and we will be
donating the code).

Best Regards,

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

Reply via email to