NetServices Stack source
Dependents: HelloWorld ServoInterfaceBoardExample1 4180_Lab4
Diff: if/ppp/PPPNetIf.cpp
- Revision:
- 9:c79fa4034f5b
- Parent:
- 5:dd63a1e02b1b
--- a/if/ppp/PPPNetIf.cpp Wed Jul 28 12:45:32 2010 +0000 +++ b/if/ppp/PPPNetIf.cpp Thu Aug 05 14:32:43 2010 +0000 @@ -35,7 +35,7 @@ #define PPP_TIMEOUT 60000 -#define BUF_SIZE 128 +#define BUF_SIZE 256 PPPNetIf::PPPNetIf(GPRSModem* pIf) : LwipNetIf(), m_pIf(pIf),/* m_open(false),*/ m_connected(false), m_status(PPP_DISCONNECTED), m_fd(0) //, m_id(0) { @@ -123,7 +123,6 @@ if( m_status == PPP_DISCONNECTED ) { - disconnect(); return PPP_PROTOCOL; } @@ -140,11 +139,12 @@ PPPErr PPPNetIf::disconnect() { - pppClose(m_fd); //0 if ok, else should gen a WARN + if(m_fd) + pppClose(m_fd); //0 if ok, else should gen a WARN m_connected = false; m_pIf->flushBuffer(); - m_pIf->printf("+++"); + m_pIf->printf("+++\r\n"); wait(.5); m_pIf->flushBuffer(); @@ -191,9 +191,13 @@ return; LwipNetIf::poll(); //static u8_t buf[128]; - int len = sio_tryread((sio_fd_t) m_pIf, m_buf, BUF_SIZE); - if(len > 0) - pppos_input(m_fd, m_buf, len); + int len; + do + { + len = sio_tryread((sio_fd_t) m_pIf, m_buf, BUF_SIZE); + if(len > 0) + pppos_input(m_fd, m_buf, len); + } while(len>0); } //Link Callback