SCTP Discussions

Text archives Help


AW: [SCTP-Discussion] Details about Timer.


Chronological Thread 
  • From: Salbrechter Bernd <bernd.salbrechter AT siemens.at>
  • To: discussion AT sctp.de
  • Subject: AW: [SCTP-Discussion] Details about Timer.
  • Date: Wed Aug 8 16:05:01 2001
  • List-id: SCTP Discussions <discussion.sctp.de>

Hello Andreas!

Interesting, that the parameter timerId in the timer callback is
uninitialized, but as I have to create a new one, that do not matter.

Clear that I have to check return values an save the timerId for later
useage, if I want to do real work with it. But my interest for now was, what
should I do in the callback to be called again a few secondes later. Now it
is clear I have to start a new timer, because the old one has been gone
already.

Thanks for that Information
Bernd

-----Ursprungliche Nachricht-----
Von: Andreas Jungmaier
[mailto:ajung AT exp-math.uni-essen.de]
Gesendet: Dienstag, 07. August 2001 14:45
An:
discussion AT sctp.de
Betreff: Re: [SCTP-Discussion] Details about Timer.


Salbrechter Bernd schrieb:
>
> Hello all!

Hi !

> I'm need timer in my application, which uses the SCTP adaption layer.
>
> I'm quite shure what sctp_startTimer do and hope that sctp_stopTimer
removes
> the timer completly.

That is what it is supposed to do ! :-)
>
> But could I use sctp_restartTimer, if I want to trigger the timer caused
the
> currently processed timeout again. Or will a timer that triggers
automaticly
> deleted?

No, once a timer expires, it is removed from the list of timer
events. So if you start one timer only, which fires after the
timer period and executes your callback, then the timerlist will
not contain any more entries. Hence there is nothing that can be
restarted.
>
> In other words: Will the following C-fragment work or not?
>
> void timeout(
> unsigned int timerid,
> void * p1
> void * p2)
> {
> sctp_restartTimer(timerid, 1000); /* Call me again one seconde later.
> */
> }

timerid would be uninitialized in this case, anyway, so
that would not work !

>
> int
> main(
> int argc,
> char **argv)
> {
> /* Some initailization. */
>
> (void) sctp_startTimer(1000, timeout, NULL, NULL);
>
> /* The SCTP mainloop. */
> }

And the return value of the startTimer funtion needs
to be stored, as it is the timer id, which can be used
to call stop or restart.

Hope that helps,

Andreas

--
---------------------------------------------------------------------------
Dipl.-Ing. Andreas Jungmaier | _
Computer Networking Technology Group | ASCII ribbon campaign ( )
University of Essen | - against HTML email X
http://www.exp-math.uni-essen.de/~ajung | & vcards / \
_______________________________________________
discussion mailing list
discussion AT sctp.de
http://www.sctp.de/mailman/listinfo/discussion




Archive powered by MHonArc 2.6.19+.

Top of page