lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Crash when doing stresstest with ppp and sockets/UDP


From: zulu4711
Subject: Re: [lwip-users] Crash when doing stresstest with ppp and sockets/UDP
Date: Wed, 20 Dec 2017 16:47:20 -0700 (MST)

Code from the application:

//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------

#define __MODULE__ "Application.c"

int insnumber=0;

#define PPP_USERNAME  "Admin"
#define PPP_PASSWORD  "pass"
        void sleepy(int ms);

#include "GSMMux.h"

#include "Debug.h"
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include <conio.h>

#include "lwip/opt.h"
#include "lwip/sys.h"
#include "lwip/timeouts.h"
#include "lwip/debug.h"
#include "lwip/stats.h"
#include "lwip/init.h"
#include "lwip/tcpip.h"
#include "lwip/netif.h"
#include "lwip/api.h"
#include "lwip/tcp.h"
#include "lwip/udp.h"
#include "lwip/dns.h"
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include <lwip/sockets.h> 

#include "netif/ppp/ppp_opts.h"

#if PPP_SUPPORT
        /* PPP includes */
        #include "lwip/sio.h"
        #include "netif/ppp/pppapi.h"
        #include "netif/ppp/pppos.h"
        #include "netif/ppp/pppoe.h"
#endif /* PPP_SUPPORT*/


/* THE PPP PCB */
ppp_pcb *ppp;
/* THE PPP interface */
struct netif ppp_netif;

sio_fd_t handleSio;

int reconnect=0;
int sendChannelDataMux(int channel, unsigned char *buf, int len);

//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
static u32_t ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) {
        int rc;
  LWIP_UNUSED_ARG(pcb);
  LWIP_UNUSED_ARG(ctx);
  rc=sendChannelDataMux(1, data, len);
  if (rc != len) {
    messageDebug(DBG_ERR, __MODULE__, __LINE__, "Holy Moly, rc=%i, len=%i",
rc, len);

        }
  return len;
          
}





//---------------------------------------------------------------------------------------
// netif link callback
//---------------------------------------------------------------------------------------
static void link_callback(struct netif *state_netif) {
        if (netif_is_link_up(state_netif)) {
                messageDebug(DBG_WAR, __MODULE__, __LINE__, 
"link_callback==UP");
        } else {
            messageDebug(DBG_WAR, __MODULE__, __LINE__, "link_callback==DOWN");
        }
}

//---------------------------------------------------------------------------------------
// netif callback
//---------------------------------------------------------------------------------------
static void status_callback(struct netif *state_netif) {
        if (netif_is_up(state_netif)) { 
                messageDebug(DBG_INFO, __MODULE__, __LINE__, 
"status_callback==UP, local
interface IP is %s", ip4addr_ntoa(netif_ip4_addr(state_netif)));
        } else {
            messageDebug(DBG_INFO, __MODULE__, __LINE__, 
"status_callback==DOWN");
        }
}


//---------------------------------------------------------------------------------------
// ppp notify phase
//---------------------------------------------------------------------------------------
void notify_phase_cb(ppp_pcb *pcb, u8_t phase, void *ctx) {
        char str[32];
        switch (phase){
                case PPP_PHASE_DEAD: 
                        strcpy(str, "PPP_PHASE_DEAD");  

                        reconnect=1;
                        break;
                case PPP_PHASE_MASTER: strcpy(str, "PPP_PHASE_MASTER"); break;
                case PPP_PHASE_HOLDOFF: strcpy(str, "PPP_PHASE_HOLDOFF"); break;
                case PPP_PHASE_INITIALIZE: strcpy(str, "PPP_PHASE_INITIALIZE"); 
break;
                case PPP_PHASE_SERIALCONN: strcpy(str, "PPP_PHASE_SERIALCONN"); 
break;
                case PPP_PHASE_DORMANT: strcpy(str, "PPP_PHASE_DORMANT"); break;
                case PPP_PHASE_ESTABLISH: strcpy(str, "PPP_PHASE_ESTABLISH"); 
break;
                case PPP_PHASE_AUTHENTICATE: strcpy(str, 
"PPP_PHASE_AUTHENTICATE"); break;
                case PPP_PHASE_CALLBACK: strcpy(str, "PPP_PHASE_CALLBACK"); 
break;
                case PPP_PHASE_NETWORK: strcpy(str, "PPP_PHASE_NETWORK"); break;
                case PPP_PHASE_RUNNING: strcpy(str, "PPP_PHASE_RUNNING"); break;
                case PPP_PHASE_TERMINATE: strcpy(str, "PPP_PHASE_TERMINATE"); 
break;
                case PPP_PHASE_DISCONNECT: strcpy(str, "PPP_PHASE_DISCONNECT"); 
break;
                default: strcpy(str, "UNKNOWN"); break;
        }
        messageDebug(DBG_INFO, __MODULE__, __LINE__, "PPP phase=%s (%i)", str,
phase);
}

//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
static void pppLinkStatusCallback(ppp_pcb *pcb, int errCode, void *ctx) {
  struct netif *pppif = ppp_netif(pcb);
  LWIP_UNUSED_ARG(ctx);

  switch(errCode) {
    case PPPERR_NONE: {             /* No error. */
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_NONE");

          messageDebug(DBG_INFO, __MODULE__, __LINE__, "   our_ipaddr  = %s",
ip4addr_ntoa(netif_ip4_addr(pppif)));
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "   his_ipaddr  = %s",
ip4addr_ntoa(netif_ip4_gw(pppif)));
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "   netmask     = %s",
ip4addr_ntoa(netif_ip4_netmask(pppif)));

      messageDebug(DBG_INFO, __MODULE__, __LINE__, "   dns1        = %s",
ipaddr_ntoa(dns_getserver(0)));
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "   dns2        = %s",
ipaddr_ntoa(dns_getserver(1)));
      break;
    }
    case PPPERR_PARAM: // Invalid parameter
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_PARAM");
      break;
    case PPPERR_OPEN: // Unable to open PPP session
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_OPEN");
      break;
    case PPPERR_DEVICE: // Invalid I/O device for PPP
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_DEVICE");
      break;
    case PPPERR_ALLOC: // Unable to allocate resources
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_ALLOC");
      break;
    case PPPERR_USER: // User interrupt
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_USER");
      break;
    case PPPERR_CONNECT: // Connection lost
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_CONNECT");
      break;
    case PPPERR_AUTHFAIL: // Failed authentication challenge
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_AUTHFAIL");
      break;
    case PPPERR_PROTOCOL: // Failed to meet protocol
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_PROTOCOL");
      break;
    case PPPERR_PEERDEAD: // Connection timeout
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_PEERDEAD");
      break;
    case PPPERR_IDLETIMEOUT: // Idle Timeout
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_IDLETIMEOUT");
      break;
    case PPPERR_CONNECTTIME: // Max connect time reached
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_CONNECTTIME");
      break;
    case PPPERR_LOOPBACK: // Loopback detected
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
PPPERR_LOOPBACK");
      break;
    default: 
      messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback:
unknown errCode %d", errCode);
      break;
  }

/*
 * This should be in the switch case, this is put outside of the switch
 * case for example readability.
 */

  if (errCode == PPPERR_NONE) {
    return;
  }

  /* ppp_close() was previously called, don't reconnect */
  if (errCode == PPPERR_USER) {
    /* ppp_free(); -- can be called here */
    return;
  }

  /*
   * Try to reconnect in 30 seconds, if you need a modem chatscript you have
   * to do a much better signaling here ;-)
   */

  messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppLinkStatusCallback: doing
ppp_connect() again");

  ppp_connect(pcb, 10);
  /* OR ppp_listen(pcb); */


}


//---------------------------------------------------------------------------------------
/* This function initializes this lwIP test. When NO_SYS=1, this is done in
 * the main_loop context (there is no other one), when NO_SYS=0, this is
done
 * in the tcpip_thread context */
//---------------------------------------------------------------------------------------
static void test_init(void * arg) { /* remove compiler warning */
        const char *username = NULL, *password = NULL;
        username = PPP_USERNAME;
        password = PPP_PASSWORD;


        /* init randomizer again (seed per thread) */
        srand((unsigned int)time(0));


        ppp = pppos_create(&ppp_netif, ppp_output_cb, pppLinkStatusCallback, 
NULL);
        if (ppp == NULL) {
                messageDebug(DBG_INFO, __MODULE__, __LINE__, "pppos_create 
error");
        } else {
                ppp_set_auth(ppp, PPPAUTHTYPE_ANY, username, password);
                ppp_connect(ppp, 1);
        }

        netif_set_default(&ppp_netif);
        netif_set_status_callback(&ppp_netif, status_callback); 
        pppapi_set_notify_phase_callback(ppp, notify_phase_cb);
        netif_set_link_callback(&ppp_netif, link_callback);

}



#define SERVER_PORT_NUM yyyyy 
#define SERVER_IP_ADDR "x.x.x.x" 

//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void thWorkerUDP(void* arg) {
         // Send out some UDP data
        int clientAddr;
    struct netconn* sendconn;
    struct netbuf *txBuf;
        struct netbuf *rxBuf;
        int i;
    void *data;
    char message[128];
        int tick=0;
        int rxerror=0;
        char *payload_data;
    unsigned short port;
    unsigned int payload_len, addr;
        int mynumber;
        //void sleepy(int ms);

        while (netif_is_link_up(&ppp_netif)==0)       sleepy(1000);


        sendconn = netconn_new( NETCONN_UDP ); 
    netconn_bind(sendconn, IP_ADDR_ANY, 0 );

        clientAddr = inet_addr(SERVER_IP_ADDR);
    netconn_connect(sendconn, &clientAddr, SERVER_PORT_NUM);                    
            

        netconn_set_recvtimeout (sendconn, 10000);
        insnumber++;
        mynumber=insnumber;
        while (1) {


                        tick++;
                        sprintf(message,"%i,CONNECT,%i", tick, mynumber);       
        
                        messageDebug(DBG_INFO, __MODULE__, __LINE__, 
"%i-Tick=%i", mynumber,
tick);

            txBuf = netbuf_new();
                        data =netbuf_alloc(txBuf, strlen(message));
                        if (data != NULL) {
                                memcpy(data, message, strlen(message));
                                netconn_send(sendconn, txBuf);    
                                netbuf_free(txBuf);
                                netbuf_delete(txBuf);
                        } else
                                messageDebug(DBG_ERR, __MODULE__, __LINE__, 
"%i-No buffers available!!",
mynumber);


                        //while(netconn_recv(sendconn, &rxBuf) != ERR_OK) 
                        //  sys_msleep(100);

                        if ((i=netconn_recv(sendconn, &rxBuf))==ERR_OK) {

                                addr = netbuf_fromaddr(rxBuf);
                                port = netbuf_fromport(rxBuf);

//                                    messageDebug(DBG_INFO, __MODULE__, 
__LINE__, "   our_ipaddr  =
%s", ip4addr_ntoa(netif_ip4_addr(pppif)));


                                payload_len = rxBuf->p->len;
                                payload_data = rxBuf->p->payload;
                                payload_data[payload_len-1]=0;
                                messageDebug(DBG_WAR, __MODULE__, __LINE__, 
"%i-UDP receive:: addr=%s,
port=%i, Len=%i, data=[%s] (timeouts=%i)", mynumber, ip4addr_ntoa(addr),
port, payload_len, payload_data, rxerror);
                                netbuf_delete(rxBuf);
                        } else {
                                rxerror++;
                                messageDebug(DBG_ERR, __MODULE__, __LINE__, 
"%i-UDP::Receive timeout,
rc=%i (timeout=%i)", mynumber, i, rxerror);
                        }

                sleepy(250);
        }


    netconn_disconnect(sendconn);
    netconn_delete(sendconn);       

}



//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void thWorkerSocket(void* arg) {

        int tick=0, i=0, rxerror=0, sent_data, recv_data=0;
        char message[2048];
        char rxbuf[128];
        int socket_fd;
        struct sockaddr_in sa,ra;
        int retry=0;
        int mynumber;

        insnumber++;
        mynumber=insnumber;


        while (netif_is_link_up(&ppp_netif)==0)       sleepy(1000);


        socket_fd = socket(PF_INET, SOCK_STREAM, 0);
        if ( socket_fd < 0 ) {
                messageDebug(DBG_INFO, __MODULE__, __LINE__, "%i-socket call 
failed",
mynumber);
                return;
        }
        
        
        memset(&sa, 0, sizeof(struct sockaddr_in));
        sa.sin_family = AF_INET;
        //sa.sin_addr.s_addr = ip4addr_ntoa(netif_ip4_addr(&ppp_netif)));//
inet_addr("127.0.0.0");
        sa.sin_addr.s_addr = INADDR_ANY;
        sa.sin_port = htons(0);


        /* Bind the TCP socket to the port SENDER_PORT_NUM and to the current
        * machines IP address (Its defined by SENDER_IP_ADDR). 
        * Once bind is successful for UDP sockets application can operate
        * on the socket descriptor for sending or receiving data.
        */

        if (bind(socket_fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) 
==
-1) {
                messageDebug(DBG_ERR, __MODULE__, __LINE__, "%i-Bind failed", 
mynumber);
                close(socket_fd);
                return;
        }



        memset(&ra, 0, sizeof(struct sockaddr_in));
        ra.sin_family = AF_INET;
        ra.sin_addr.s_addr = inet_addr(SERVER_IP_ADDR);
        ra.sin_port = htons(SERVER_PORT_NUM);

        if(connect(socket_fd,(struct sockaddr_in*)&ra,sizeof(struct 
sockaddr_in)) <
0) {
                messageDebug(DBG_ERR, __MODULE__, __LINE__, "%i-connect failed 
",
mynumber);
                close(socket_fd);
                return;
        }



        while (1) {


                        tick++;
                        messageDebug(DBG_WAR, __MODULE__, __LINE__, 
"%i-Tock=%i", mynumber,
tick);

                        sprintf(message,"%i,CONNECT,%i,", tick, mynumber);      
        
                        for (i=0; i<10; i++)
                                strcat(message,"0123456789");

                        strcat(message, "\r");
                        sent_data = send(socket_fd, message, strlen(message)+1, 
0);


                        if (sent_data < 0) {
                                messageDebug(DBG_ERR, __MODULE__, __LINE__, 
"%i-Send failed", mynumber);
                                close(socket_fd);
                                socket_fd = socket(PF_INET, SOCK_STREAM, 0);
                                if ( socket_fd < 0 ) {
                                        messageDebug(DBG_ERR, __MODULE__, 
__LINE__, "%i-socket call failed",
mynumber);
                                        continue;
                                }
                                
                                
                                memset(&sa, 0, sizeof(struct sockaddr_in));
                                sa.sin_family = AF_INET;
                                sa.sin_addr.s_addr = INADDR_ANY;
                                sa.sin_port = htons(0);
                                if (bind(socket_fd, (struct sockaddr *)&sa, 
sizeof(struct sockaddr_in))
== -1) {
                                        messageDebug(DBG_ERR, __MODULE__, 
__LINE__, "%i-Bind failed",
mynumber);
                                        close(socket_fd);
                                        continue;
                                }

                                if(connect(socket_fd,(struct 
sockaddr_in*)&ra,sizeof(struct
sockaddr_in)) < 0) {
                                        messageDebug(DBG_ERR, __MODULE__, 
__LINE__, "%i-connect failed",
mynumber);
                                        close(socket_fd);
                                        sleepy(10000);
                                }
                        } else {
                                recv_data = recv(socket_fd, rxbuf, 
sizeof(rxbuf), 0);
                                if (recv <= 0) {
                                        rxerror++;
                                        messageDebug(DBG_ERR, __MODULE__, 
__LINE__, "%i-Socket::Receive
timeout, rc=%i (timeout=%i)", mynumber, i, rxerror);
                                        close(socket_fd);
                                        sleepy(10000);
                                } else {
                                        rxbuf[recv_data-1]=0;
                                        messageDebug(DBG_WAR, __MODULE__, 
__LINE__, "%i-Socket::Receive data
[%s], length=%i, errors=%i", mynumber, rxbuf, recv_data, rxerror);
                                }
                        }
                sleepy(250);
                //sleepy(1000000);
        }
}


unsigned int sendSerial(unsigned char* data, unsigned int len) {
        sleepy(100);
        return sio_write((sio_fd_t)(handleSio), data, len);
}

unsigned int readSerial(unsigned char* data, unsigned int len) {
        return sio_read((sio_fd_t)(handleSio), data, len);
}

void dumpsio(void) {
        showsio(handleSio);
}

void feedPPP(unsigned char *buf, int length) {
        if (ppp)
                pppos_input(ppp, buf, length);
}




//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void thATInjector1(void) {
        char cmd[64];
        int tick=0;

        while (1) {
                sleepy(1000);
                tick++;
                
                if ((tick%600)==0) {
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Killing 
GPRS :(");
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Toggle 
DTR");
                        sendMSCMux(1, MSC_TO_MODEM_RTS);
                        sleepy(1000);
                        sendMSCMux(1, MSC_TO_MODEM_RTS | MSC_TO_MODEM_DTR);
                }


                if (reconnect) {
                        reconnect=0;
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Dialing 
GPRS :)");
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Toggle 
DTR");
                        sendMSCMux(1, MSC_TO_MODEM_RTS);
                        sleepy(1000);
                        sendMSCMux(1, MSC_TO_MODEM_RTS | MSC_TO_MODEM_DTR);

                        strcpy(cmd, "AT&D2\r"); 
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending 
[%s] to channel 1",
cmd);
                        sendChannelDataMux(1, cmd, strlen(cmd));
                        sleepy(500);

                        strcpy(cmd, "AT+CGDCONT=1,\"IP\", \"internet\"\r");
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending 
[%s] to channel 1",
cmd);
                        sendChannelDataMux(1, cmd, strlen(cmd));
                        sleepy(1000);

                        strcpy(cmd, "ATD*99#\r");
                        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending 
[%s] to channel 1",
cmd);
                        sendChannelDataMux(1, cmd, strlen(cmd));
                        if (ppp)
                                ppp_connect(ppp, 1); 
                }
        }
}


//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void thATInjector2(void) {
        char cmd[64];

        strcpy(cmd, "AT+CREG=2\r");
        messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending [%s] to channel 2",
cmd);

        sendChannelDataMux(2, cmd, strlen(cmd));


        while (1) {
                strcpy(cmd, "ATI\r");
                messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending [%s] to 
channel 2",
cmd);

                sendChannelDataMux(2, cmd, strlen(cmd));

                sleepy(5000);

        }
}

//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void thATInjector3(void) {

        while (1) {
                char cmd[64];
                strcpy(cmd, "ATI1\r");
                messageDebug(DBG_ERR, __MODULE__, __LINE__, "Sending [%s] to 
channel 3",
cmd);
                sendChannelDataMux(3, cmd, strlen(cmd));

                sleepy(6000+(rand()%1000));
        }
}



//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
void pppClose(void) {
        if (ppp==NULL)
                return;
        ppp_close(ppp, 0);
}



int gConnect=0;



//---------------------------------------------------------------------------------------
/* This is somewhat different to other ports: we have a main loop here:
 * a dedicated task that waits for packets to arrive. This would normally be
 * done from interrupt context with embedded hardware, but we don't get an
 * interrupt in windows for that :-) */
//---------------------------------------------------------------------------------------
static void main_loop(void) {
        err_t err;
        char str[256];


        handleSio = sio_open(0);

        messageDebug(DBG_NOTE, __MODULE__, __LINE__, "Starting application");

        disconnectMux();
        showsio(handleSio);
        sleepy(1000);
        disconnectMux();
        showsio(handleSio);
        sleepy(1000);


        strcpy(str, "AT\r");
        sendSerial(str, strlen(str));
        sleepy(1000);
        showsio(handleSio);

        strcpy(str, "AT\\Q3\r");
        sendSerial(str, strlen(str));
        sleepy(1000);
        showsio(handleSio);


        strcpy(str, "ATE1\r");
        sendSerial(str, strlen(str));
        sleepy(500);
        showsio(handleSio);


        strcpy(str, "AT+CMUX=0\r");
        sendSerial(str, strlen(str));
        sleepy(500);
        showsio(handleSio);
        
        initMux();
        openChannelsMux(3, 98);
        

        while(isChannelOpenMux(1)==0 || isChannelOpenMux(2)==0 ||
isChannelOpenMux(3)==0) sleepy(1000);

        reconnect=1;

        _beginthread(thATInjector1,0,NULL);
        //_beginthread(thATInjector2,0,NULL);
        //_beginthread(thATInjector3,0,NULL);

        while (gConnect==0) sleepy(1000);

        tcpip_init(NULL, NULL);
        test_init(NULL);

        //while (netif_is_link_up(&ppp_netif)==0)       sys_msleep(1000);


        _beginthread(thWorkerUDP,0,NULL);

        
        sleepy(1000);
        _beginthread(thWorkerUDP,0,NULL);
        sleepy(1300);
        _beginthread(thWorkerSocket,0,NULL);
        sleepy(1500);
        _beginthread(thWorkerSocket,0,NULL);
        

        

        /* MAIN LOOP for driver update (and timers if NO_SYS) */
        while (!_kbhit()) {
                sleepy(100);
        }

    if(ppp) {
                u32_t started;
                messageDebug(DBG_INFO, __MODULE__, __LINE__, "Closing PPP 
connection...");
                ppp_close(ppp, 1);
                /* make sure to disconnect PPP before stopping the program... */
                pppapi_close(ppp, 0);
                ppp = NULL;
                /* Wait for some time to let PPP finish... */
                started = sys_now();
                do {
                        sys_msleep(50);
                        /* @todo: need a better check here: only wait until PPP 
is down */
                } while(sys_now() - started < 5000);
    }

        {
                char x;
                scanf("%c", &x);
        }
}


//---------------------------------------------------------------------------------------
// 
//---------------------------------------------------------------------------------------
int main(int argc,char* argv[]) {

        initDebug();

        main_loop();

        while (!_kbhit()) sys_msleep(50);
        deInitDebug();
        return 0;
}





--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

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