EthernetNetIf Compatibility.
Dependents: XBeeWiFi_SPI_example
Fork of NetServicesSource by
Revision 3:95e0bc00a1bb, committed 2010-06-18
- Comitter:
- donatien
- Date:
- Fri Jun 18 10:38:57 2010 +0000
- Parent:
- 2:a4f97773c90f
- Child:
- 4:fd826cad83c0
- Commit message:
Changed in this revision
--- a/if/lwip/LwipNetIf.cpp Fri Jun 18 09:22:54 2010 +0000 +++ b/if/lwip/LwipNetIf.cpp Fri Jun 18 10:38:57 2010 +0000 @@ -31,9 +31,9 @@ //See doc/rawapi.txt for details -LwipNetIf::LwipNetIf() : NetIf(), m_tcpTimer(), m_init(false) +LwipNetIf::LwipNetIf() : NetIf(), m_tcpTimer(), m_dnsTimer(), m_init(false) { - m_tcpTimer.start(); + } @@ -51,6 +51,7 @@ //Setup Clocks m_tcpTimer.start(); + m_dnsTimer.start(); //m_tcpTicker.attach_us( tcp_tmr, TCP_TMR_INTERVAL * 1000 ); //TCP_TMR_INTERVAL = 250 ms in tcp_impl.h //m_dnsTicker.attach_us( dns_tmr, DNS_TMR_INTERVAL * 1000 ); //DNS_TMR_INTERVAL = 1000 ms in dns.h } @@ -77,11 +78,16 @@ void LwipNetIf::poll() { - if(m_init && m_tcpTimer.read_ms()>=TCP_TMR_INTERVAL) + if(m_init && m_tcpTimer.read_ms() >= TCP_TMR_INTERVAL) { m_tcpTimer.reset(); tcp_tmr(); //Poll LwIP } + if(m_init && m_dnsTimer.read_ms() >= DNS_TMR_INTERVAL) + { + m_dnsTimer.reset(); + dns_tmr(); + } //Do some stuff... }
--- a/if/lwip/LwipNetIf.h Fri Jun 18 09:22:54 2010 +0000 +++ b/if/lwip/LwipNetIf.h Fri Jun 18 10:38:57 2010 +0000 @@ -50,6 +50,7 @@ private: Timer m_tcpTimer; + Timer m_dnsTimer; bool m_init;
--- a/if/lwip/lwipNetDnsRequest.cpp Fri Jun 18 09:22:54 2010 +0000 +++ b/if/lwip/lwipNetDnsRequest.cpp Fri Jun 18 10:38:57 2010 +0000 @@ -56,7 +56,6 @@ void LwipNetDnsRequest::poll() { err_t err; - dnsTick(); switch(m_state) { case LWIPNETDNS_START: //First req, let's call dns_gethostbyname @@ -149,21 +148,5 @@ return pMe->foundCb( name, ipaddr ); } -void LwipNetDnsRequest::dnsTick() -{ - static Timer* pTmr = NULL; - if(!pTmr) - { - pTmr = new Timer; - pTmr->start(); - } - if(pTmr->read_ms() >= DNS_TMR_INTERVAL) - { - pTmr->reset(); - dns_tmr(); - DBG("DNS Tick\n"); - } -} - #endif
--- a/if/lwip/lwipNetDnsRequest.h Fri Jun 18 09:22:54 2010 +0000 +++ b/if/lwip/lwipNetDnsRequest.h Fri Jun 18 10:38:57 2010 +0000 @@ -61,8 +61,6 @@ //Static callbacks : Transforms into a C++ callback static void sFoundCb(const char *name, ip_addr_t *ipaddr, void *arg); - static void dnsTick(); - bool m_closing; };
--- a/lwip/lwipopts.h Fri Jun 18 09:22:54 2010 +0000 +++ b/lwip/lwipopts.h Fri Jun 18 10:38:57 2010 +0000 @@ -113,7 +113,7 @@ #if TARGET_LPC1768 -#define MEM_SIZE 5000 //2000 +#define MEM_SIZE 3000 //2000 /// @@ -182,14 +182,14 @@ /* TCP Maximum segment size. */ //#define TCP_MSS 1024 -#define TCP_MSS 1024//0x276//536//0x276 +#define TCP_MSS 1024//536//0x276 /* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 2048//2048 +#define TCP_SND_BUF 2048 /* TCP sender buffer space (pbufs). This must be at least = 2 * TCP_SND_BUF/TCP_MSS for things to work. */ -#define TCP_SND_QUEUELEN (8 * TCP_SND_BUF/TCP_MSS)//(4 * TCP_SND_BUF/TCP_MSS) +#define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS) /* TCP writable space (bytes). This must be less than or equal to TCP_SND_BUF. It is the amount of space which must be
--- a/services/http/client/HTTPClient.cpp Fri Jun 18 09:22:54 2010 +0000 +++ b/services/http/client/HTTPClient.cpp Fri Jun 18 10:38:57 2010 +0000 @@ -144,7 +144,7 @@ void HTTPClient::setTimeout(int ms) { - m_timeout = 1000*ms; + m_timeout = ms; //resetTimeout(); } @@ -154,7 +154,7 @@ { return; } - if(m_watchdog.read_us()>m_timeout) + if(m_watchdog.read_ms()>m_timeout) { onTimeout(); } @@ -396,6 +396,9 @@ onResult(HTTP_CONN); return; } + + if(len>0) + resetTimeout(); if(m_state == HTTP_READ_DATA_INCOMPLETE) return;
--- a/services/http/server/HTTPRequestDispatcher.cpp Fri Jun 18 09:22:54 2010 +0000 +++ b/services/http/server/HTTPRequestDispatcher.cpp Fri Jun 18 10:38:57 2010 +0000 @@ -96,7 +96,7 @@ DBG("Using default handler\n"); it = m_pSvr->m_lpHandlers.end(); it--; //Get the last element - if( ! (((*it).first.length() == 0) || (*it).first.compare("/")) ) //This is not the default handler + if( ! (((*it).first.length() == 0) || !(*it).first.compare("/")) ) //This is not the default handler it = m_pSvr->m_lpHandlers.end(); root_len = 0; }