Do you see anything obviously wrong in this fix?
I Don't.
GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to
this fix
I would name this function GetErrorMsgFromErrorCode since it is a general
translation from an error number to a message. Probably the implementation
should as well call the API to get Windows error message description from
Windows error code. This way it is perfectly generic. We still have the
problem of colliding error code which exists since the beginning.
--
[email protected]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
----- Original Message -----
From: "Arno Garrels" <[email protected]>
To: "ICS support mailing" <[email protected]>
Sent: Saturday, February 12, 2011 10:41 AM
Subject: Re: [twsocket] TFtpCli strange logic
Francois PIETTE wrote:
1) Command Open succeeds.
2) After the server received command User it closes the connection
(FIN/ACK).
3) OnSessionClosed triggers with ErrCode 0.
4) OnRequestDone triggers with ErrCode 0 and the status code from
previous request.
Would you agree that is a bug?
If the server closes the connection as a reaction to a command except
quit, then OnrequestDone should report a failure code, probably
WSAECONNRESET.
Do you see anything obviously wrong in this fix?
procedure TCustomFtpCli.ControlSocketSessionClosed(
Sender : TObject;
ErrCode : Word);
var
LClosedState : TFtpState;
begin
LClosedState := FState;
if FConnected then begin
FConnected := FALSE;
if FState <> ftpAbort then
StateChange(ftpNotConnected);
if Assigned(FOnSessionClosed) then
FOnSessionClosed(Self, ErrCode);
end;
if FState <> ftpAbort then
StateChange(ftpInternalReady);
if FRequestType <> ftpRqAbort then begin
if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and //<==
(LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then
begin //<==
FLastResponse := '500 Control connection closed - ' +
GetWinsockOrProxyErrorStr(ErrCode); // <==
New function, not related to this fix
FStatusCode := 500;
FRequestResult := FStatusCode; { 06 apr 2002 }
SetErrorMessage;
end;
TriggerRequestDone(FRequestResult);
end;
end;
--
Arno Garrels
--
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
--
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