Arno Garrels wrote:
> Wilfried Mestdagh wrote:
>> Hello Arno,
>> 
>>> I think it is impossible that OnSessionClosed is fired twice, because
>>> it is always checked whether FCloseInvoked = FALSE.
>>> Isn't it possible that there are multiple instances?
>> 
>> I just ahve posted same message again, sorry for that (need some
>> coffee). No there is only 1 instance that is the strange thing. The
>> TWSocket is created in constructor and destroyed in destructor. Both are
>> only called in program startup and terminate. Very strange.
> 
> You may be right since in procedure TCustomWSocket.TryToSend FCloseInvoked
> is _not_ checked.
> 
> FCloseInvoked := TRUE;           { 23/07/98 }
> Close;
> TriggerSessionClosed(LastError); { 23/07/98 }

So if Do_FD_CLOSE (FD_CLOSE message received) would be called while looping
in TryToSend session closed could be triggered twice.

May be the close stuff in TryToSend should be changed to:

if not FCloseInvoked then begin
    FCloseInvoked := TRUE;
    TriggerSessionClosed(msg.LParamHi);
end;
if FState <> wsClosed then
    Close;

Arno
-- 
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