11-19-2019, 02:20 PM
Hi,
How to correctly break SSL request that is launched in background thread ?
nowadays I have situation when TIdSSLSocket is destroyed after calling Disconnect:
call-stack for this is
as a workaround, I can suggest to add checking like if fSSL = nil then Break; in the beginning of loop
How to correctly break SSL request that is launched in background thread ?
nowadays I have situation when TIdSSLSocket is destroyed after calling Disconnect:
Quote:IdSSLOpenSSL.TIdSSLSocket.Destroybut TIdSSLSocket.Send is still executed and I have AV because fSSL is nil:
System.TObject.Free
IdSSLOpenSSL.TIdSSLIOHandlerSocketOpenSSL.Close
IdTCPConnection.TIdTCPConnection.Disconnect(???)
IdTCPConnection.TIdTCPConnection.Disconnect
Code:
function TIdSSLSocket.Send(const ABuffer: TIdBytes; AOffset, ALength: Integer): Integer;
var
ret, err: Integer;
begin
Result := 0;
repeat
ret := SSL_write(fSSL, @ABuffer[AOffset], ALength); //<<<< AV
Quote:IdSSLOpenSSL.TIdSSLSocket.Send(...)
IdSSLOpenSSL.TIdSSLIOHandlerSocketOpenSSL.SendEnc(???,???,224)
IdSSL.TIdSSLIOHandlerSocketBase.WriteDataToTarget(???,???,224)
IdIOHandler.TIdIOHandler.WriteDirect(...)
IdIOHandler.TIdIOHandler.WriteBufferFlush(???)
IdIOHandler.TIdIOHandler.WriteBufferFlush
IdIOHandler.TIdIOHandler.WriteBufferClose
IdHTTP.TIdHTTPProtocol.BuildAndSendRequest(???)
IdHTTP.TIdCustomHTTP.ConnectToHost($7EA93560,???)
IdHTTP.TIdCustomHTTP.DoRequest(???,'https://.....',$7E91CBF0,$7E9B7AA0,(...))
IdHTTP.TIdCustomHTTP.Post('https://......',$8663B0,$7E9B7AA0)
as a workaround, I can suggest to add checking like if fSSL = nil then Break; in the beginning of loop