From: Denis V. D. <de...@nu...> - 2001-06-07 18:02:23
|
"Peter M. Lemmen" <le...@ho...> writes: > I've been having an odd problem since using Icqlib 1.0.0 in my icq client. > I've added support for handling Timeouts which works on the following logic: > > When a icq_SetTimeout event is generated... > If the interval is -1, the current Timeout is cleared. > If the interval is 0, the current Timeout is cleared. > If the interval is larger then 0, the current Timeout is changed to Now() > + interval. > > When the Timeout passes... > icq_HandleTimeout is called. > And the Timeout is cleared. Everything is fine so far. > My login sequence is as follows: > > icq_Init is called to initialize the link. > Callbacks are registered with the link. > icq_Connect is called to create the UDP connection. > icq_Login is called to send the login information to the server. > The icq contacts are added to the link. > icq_SendContactList is called. > icq_SendVisibleList is called. And this is wrong. Move "The icq contacts are added to the link" step before "icq_Login is called to send the login information to the server" because icq_Login() sends all your contact information itself. It means you send your contact list twice, that's why you experience timeouts. In other words, you shouldn't call icq_SendContactList(), icq_SendVisibleList() & icq_SendInvisibleList() functions manually on login. Just populate those lists before calling icq_Login(). If you change your contact list after login (add new buddy), call icq_SendNewUser() function (subject to rename!!!). Call icq_SendVisibleList() & icq_SendInvisibleList() functions on any changes in those lists as usual - there is no special functions to send single new user added to them. > I believe the icq_Login and/or the contact list calls generate a (15 second) > Timeout event. Within those 15 seconds the user is logged in and all the > UserOnline events are received. > The timeout is not cleared however, and when the 15 seconds are up, > HandleTimeout is called. A few seconds after that we get the whole list of > UserOnline messages again, as if the contact list packets were resent. It happens because ICQ server has special "feature" to drop packets when they come too fast from the client, i.e. to prevent flood. Login procedure generates a lot of the packets and some of them could be lost, that's why we need Timeout manager - to resend unacknowledged (potentially lost) packets. > I think the Ack messages for the Contact list and Visible List get lost > somewhere so icqlib is unable to match them up with the original sent > packets. Or just there was no Ack packets from the server at all... > Is my handling logic of the Timeouts correct? Especially the double-clear > case with a zero interval. Yes, that is correct. > Why is the contact list not acknowledged properly? Would it help if I moved > the sending of the contact and visible lists into the icq_Logged event? (Ie, > after the login was properly handled.) Try to implement it like I said before. > ---------------------------------------------------------------- > Peter M. Lemmen Peter's ICQ Client > www.outreach.nl www.outreach.nl/picq > pe...@le... pi...@ou... > ---------------------------------------------------------------- As I already mentioned on the icqlib forum picq name is already taken: http://www.datanaut.com/picq -- Denis V. Dmitrienko | E-mail: de...@de... | ICQ#: 5538614 Home page: http://denix.org | de...@kd... History became legend... Legend became myth. And some things that should not have been forgotten ...were lost. |