LCP too many retries

I am opening a PPP link of a direct serial port, it works OK normally but at times there is a connection problem and I get the following report on stdio.
( PPP_DEBUG and PPP_VERBOSE defined)

PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: sending LCP config req i/f 0
PPP: LCP too many retries i/f 0

The loop the program is in is
while(ifpending(IF_PPP2) % 2)
{
tcp_tick(NULL); //wait for PPP to come up
}

How do I detect the to many retries as at that point the PPP stops trying to connect but is still flagged as connection pending so the loop never exits.