You won't be able to reproduce this. This is only occurring because I've modified the exception handler in ASyncReceive to call HandleBackGroundException, which in turn calls Abort. The version in SVN does not call Abort when an exception occurs in ASyncReceive (or associated event handlers).
I'm not sure the best way to handle it, since TCustomSSLWSocket.InternalAbort doesn't have the TCustomLineWSocket properties available. One ugly hack would be to add this to TCustomSSLWSocket.InternalAbort: if InheritsFrom(TCustomLineWSocket) then TCustomLineWSocket(Self).FRcvdCnt := 0; I don't have historical Delphi versions available to determine when InheritsFrom was introduced. :( I can confirm that this prevents the second OnDataAvailable from being called. Unfortunately, it will always "clear" the data when InternalAbort is called. If data has been received but not previously sent to OnDataAvailable, then it would never be seen by the application. I'd rather TCustomLineWSocket. TriggerSessionClosed "know" whether the current data has been send to OnDataAvailable and only send it again if it has not already been sent. I can't find any place that FRcvdCnt is involved when freeing memory, I think this is safe to do. And TCustomLineWSocket.TriggerSessionClosed is setting FRcvdCnt := 0 before it exits anyway. Unfortunately, it has been years since I spent any time in the ICS source. Finding a "proper" solution would require more time than I can invest. :( For the time being, my hack of setting LineMode := False in OnBgException will work for me. Requested Call Stack: uUpdateServiceDaemon.TmeUpdateServiceDaemon.ClientDataAvailable($215BF40,0) OverbyteIcsWSocket.TCustomWSocket.TriggerDataAvailable(???) OverbyteIcsWSocket.TCustomSocksWSocket.TriggerDataAvailable(???) OverbyteIcsWSocket.TCustomLineWSocket.TriggerSessionClosed(0) OverbyteIcsWSocketS.TWSocketClient.TriggerSessionClosed(???) OverbyteIcsWSocket.TCustomWSocket.InternalClose(???,0) OverbyteIcsWSocket.TCustomSslWSocket.InternalAbort(???) OverbyteIcsWSocket.TCustomWSocket.Abort OverbyteIcsWSocket.TCustomWSocket.HandleBackGroundException(???) OverbyteIcsWSocket.TCustomWSocket.ASyncReceive(0,[]) OverbyteIcsWSocket.TCustomWSocket.Do_FD_READ(???) OverbyteIcsWSocket.TCustomSslWSocket.Do_FD_READ((1064, 948, 1, 0, 948, 0, 1, 0, 0, 0)) OverbyteIcsWSocket.TCustomWSocket.WMASyncSelect((1064, 948, 1, 0, 948, 0, 1, 0, 0, 0)) OverbyteIcsWSocket.TCustomWSocket.WndProc(???) OverbyteIcsWSocket.TCustomSslWSocket.WndProc(???) OverbyteIcsWSocket.TCustomLineWSocket.WndProc(???) OverbyteIcsWndControl.TIcsWndHandler.WndProc((1064, 948, 1, 0, 948, 0, 1, 0, 0, 0)) OverbyteIcsWndControl.WndControlWindowsProc(???,???,948,1) :74ca6238 ; C:\Windows\syswow64\USER32.dll :74ca68ea ; C:\Windows\syswow64\USER32.dll :74ca7d31 ; C:\Windows\syswow64\USER32.dll :74ca7dfa USER32.DispatchMessageW + 0xf Forms.TApplication.ProcessMessage(???) On Fri, Mar 26, 2010 at 4:56 AM, DZ-Jay <[email protected]> wrote: > > On Mar 26, 2010, at 04:02, Jon Robertson wrote: > > > To clarify, OnDataAvailable has received complete data, say: > > help\n > > > > In processing that data, an exception occurs and TWSocket.Abort is called > to > > abort the connection. Before .Abort returns, OnDataAvailable is called > > again, with the exact same that was already being processed: > > help\n > > > > But the client has only sent the data once. > > Oh, I see. The Abort method calls OnDataAvailable because the even was > never completely handled, and thus the component still thinks the received > data is available. > > I'm not sure how this could be handled in the component. > > I'm using a Mac at this moment so I cannot test this. Can you show me the > call stack of when the second OnDataAvailable is triggered? I can't seem to > find an obvious execution flow in the code (it's very early still). > > dZ. > > > -- > DZ-Jay [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > > -- > 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 > -- Jon Robertson Borland Certified Advanced Delphi 7 Developer Good programming is 40% experience, 30% skill, 20% RTFM, 10% caffeine, and 5% attention to detail. -- 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
