|
From: Bill S. <we...@ri...> - 2001-05-09 01:20:58
|
On Tue, 8 May 2001, Denis V. Dmitrienko wrote: > "Henric Larsson" <h-...@ak...> writes: > > > Hi, I'm trying to do some work on the miranda codebase. but I can't figure > > out how to do automatic resend of packages that doesn't get ACK'ed by the > > server. > > You should use icq_SetTimeout callback which tells you to wait "interval" > seconds and call icq_HandleTimeout() function back when that timeout has > elapsed. > > It is correct for icqlib 1.0.0. I'm not sure about latest icqlib > though. Bill added some more features to the "Timeout Manager" code. > It should work the same way but there could be some tweaks. You're right, to the library client it works exactly the same way. I just generalized the code so I could use them in my TCP code, and made some improvements... Mainly the timeout manager keeps a sorted list of all the timeouts so it doesn't need to send out an icq_SetTimeout call for every timer. The library client only needs to manage one timer at a time now, which should be easier for the library users. Old code that manages multiple timers will still work, it's just not necessary to handle more than one timer anymore. It doesn't hurt to call icq_HandleTimeout multiple times, it will just do nothing if there are no expired timeouts. New method looks something like this: .. 2 udp packets go out, 10 second timeout for each ... icq_SetTimeout(10); /* app should call icq_HandleTimeout in 10 seconds */ .. 5 seconds elapse .. .. 1 udp packet goes out, 10 second timeout, note no set timeout call! .. .. 5 seconds elapse .. icq_HandleTimeout(); /* app calls handle timeout */ .. icqlib processes first 2 UDP timeouts during handle timeout call .. .. after processing timeouts, next timeout is expired in 5 seconds .. icq_SetTimeout(5); /* app should call icq_HandleTimeout in 5 seconds */ .. 5 seconds elapse .. icq_HandleTimeout(); /* app calls handle timeout */ Bill |