lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] What is the meaning of got PPPERR_USER in status_callba


From: Sylvain Rochet
Subject: Re: [lwip-users] What is the meaning of got PPPERR_USER in status_callback?
Date: Wed, 8 Mar 2017 22:42:12 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Axel,


On Wed, Mar 08, 2017 at 10:02:59PM +0800, Axel Lin wrote:
> 
> Thanks a lot, Sylvain.
> 
> I checked the code and you are right.
> I was expecting I will get PPPERR_NONE soon after ppp_connect().
> So I wait for 20 seconds but don't get PPPERR_NONE and the error path
> calls ppp_close.

Setting a timeout with an arbitrarily chosen value without taking first 
into consideration how much time it takes when it works properly doesn't 
sound like a bright idea...


> Further question:
> I'm not sure if link_status_cb will be always get called no matter
> success or fail,
> that is why I wait for 20 seconds and give up.
> Should I always wait until I link_status_cb get called?

You should wait. Once you called ppp_connect, it is guaranteed that 
status callback will be called sooner or later. If there are cases when 
it is not, you can slap me in the face because this is a HUGE bug which 
must be fixed.

Except if it returns ERR_ALREADY but that can't really happens unless 
you are calling it when the session is already started/estabished, which 
does not make sense...


Anyway, you are right it was a bit confusing because ppp_connect was 
actually propagating the error code from the link level driver, and in 
this case even if ppp_connect returned a value different than ERR_OK 
(except ERR_ALREADY, as previously stated) you had to wait anyway. Since 
this error path is useless I reworked it in commit e16d10ade620 so 
ppp_connect (and its ppp_listen friend) can now only returns ERR_OK or 
ERR_ALREADY.


Sylvain

Attachment: signature.asc
Description: Digital signature


reply via email to

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