linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Background mode handling in iOS


From: Ivan Sergeyenko
Subject: [Linphone-developers] Background mode handling in iOS
Date: Wed, 26 Oct 2011 17:40:35 -0400

Hi all,

I'm looking at the "entering background mode" section of iOS porting
documentation 
(http://mirror.csclub.uwaterloo.ca/nongnu/linphone/docs/liblinphone/modules.html).
It's describing what should be done very clearly, but _why_ one must
do all these things is a lot less clear.

We start off with the following:

//First refresh registration
linphone_core_refresh_registers(theLinphoneCore);

OK, I can understand that. We want to make sure that we refresh the
registration before the first keepalive handler is scheduled (up to)
10 minutes later. But the next few lines completely baffle me:

//wait for registration answer
int i=0;
while (!linphone_proxy_config_is_registered(proxyCfg) && i++<40 ) {
    linphone_core_iterate(theLinphoneCore);
    usleep(100000);
}

Why do we need this while loop? Is it because we want to make sure
that the registration is completed before we try to re-register
(keepalive handler might get fired as soon as it is registered). Is
that really necessary? Even if we prevent this from occurring the
first time around, nothing is preventing the second handler to restart
registration while the first handler's registration is still in
progress.

In any case, even if this code really is necessary, do the constants
(40 and 100000) have some special meaning or they're just chosen
arbitrarily?

Any explanation would be greatly appreciated!

Thanks,
Ivan Sergeyenko



reply via email to

[Prev in Thread] Current Thread [Next in Thread]