Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:3ee499525aa5, committed 2010-06-14
- Comitter:
- iva2k
- Date:
- Mon Jun 14 03:24:33 2010 +0000
- Parent:
- 0:e614f7875b60
- Commit message:
Changed in this revision
diff -r e614f7875b60 -r 3ee499525aa5 HttpServerTcpSockets.cpp
--- a/HttpServerTcpSockets.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/HttpServerTcpSockets.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -33,6 +33,7 @@
//#endif
HTTPServer svr;
StreamServer stream;
+Serial pc(USBTX, USBRX);
int gDebug=MY_DEBUG_LEVEL;
float gWait = 0.005; // Main loop wait timeout
@@ -41,6 +42,7 @@
bool use_sd = false;
unsigned int cnt = 0;
+pc.baud(115200);
Base::add_rpc_class<DigitalOut>();
printf("\r\nSetting up...\r\n");
@@ -90,11 +92,13 @@
char buf[100];
int len = sprintf(buf, ".tick.%d======================================================================\r\n", cnt);
stream.sendToAll(buf, len);
+ printf("%s - %d clients\r\n", buf, stream.countClients());
+// printf(".tick.%d - %d clients\r\n", cnt, stream.countClients());
}
tm.start();
cnt++;
}
- wait(gWait);
+// wait(gWait);
}
return 0;
diff -r e614f7875b60 -r 3ee499525aa5 README.txt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt.h Mon Jun 14 03:24:33 2010 +0000 @@ -0,0 +1,27 @@ +README.txt.h + +TODO LIST: + +- HTTP Server performance is ~1-2kB/s. Need way better than this +- Port Ilya's link monitor from old HTTPServer +- Port Ilya's RPC improvements from old HTTPServer +- Port Ilya's NTP service from old HTTPServer +- Fix webfs root for files +- Need more DHCP options (work without link, call DHCP upon link) +- auto index.htm +- Fix headers on 404, RPC, other pages +- Date of files in Headers? Cache control headers +- StreamServer abstraction for request handler (mostly for API for custom protocol handlers) + + +INFO +- Based on Donatien Garnier's "Net" code v1.00 + http://mbed.org/users/donatien/programs/NetServicesSource +- HTTPServer +- Ilya's StreamServer.h/.cpp provide simple TCP streaming service +- Misc Changes: + - Compilation errors fixed + - Debug messages cleaned up (no leading /r/n, better tie-in for LWIP messages) + - + +##END \ No newline at end of file
diff -r e614f7875b60 -r 3ee499525aa5 StreamServer.cpp
--- a/StreamServer.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/StreamServer.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -35,17 +35,18 @@
StreamRequestDispatcher::~StreamRequestDispatcher()
{
+//DBG("deleting\r\n");
close();
}
int StreamRequestDispatcher::writeData(const char* buf, int len)
{
if(m_closed) {
-DBG("\r\nIN StreamRequestDispatcher::writeData - m_closed\r\n");
+//DBG("m_closed\r\n");
return TCPSOCKET_RST;
}
int ret = m_pTcpSocket->send(buf, len);
-if (ret != len) DBG("\r\nStreamRequestDispatcher::writeData - ret=%d\r\n", ret);
+if (ret != len) DBG("ret=%d\r\n", ret);
return ret;
}
@@ -55,8 +56,10 @@
string request;
const char* buf;
int len, ret;
- DBG("\r\nIN StreamRequestDispatcher::dispatchRequest()\r\n");
+// DBG("\r\n");
+//FIXME: here is the place to implement custom request handler
+
while ( getRequest(&request) )
{
// Just echo it back
@@ -64,26 +67,30 @@
len = strlen(buf);
ret = writeData(buf,len);
writeData("\r\n",2);
- DBG("\r\nReceived req (%s), write ret=%d\r\n", buf, ret);
+ DBG("Received req (%s), write ret=%d\r\n", buf, ret);
}
}
void StreamRequestDispatcher::close() //Close socket and destroy data
{
- if(m_closed)
+ if(m_closed) {
+//DBG("already closed\r\n");
return;
+ }
m_closed = true; //Prevent recursive calling or calling on an object being destructed by someone else
+//DBG("removing from list\r\n");
m_pSvr->m_lpClients.remove(this);
if(m_pTcpSocket)
{
+//DBG("closing socket\r\n");
m_pTcpSocket->resetOnEvent();
- m_pTcpSocket->close();
+ m_pTcpSocket->close(); // FIXME: in bad cause of events, getting "could not close properly, abort" log message
delete m_pTcpSocket;
}
+//DBG("closing service\r\n");
NetService::close();
}
-//FIXME: Need implementation for StreamServer
bool StreamRequestDispatcher::getRequest(string* request)
{
const int maxLen = 64;
@@ -119,7 +126,7 @@
}
*p = 0;
- DBG("\r\nParsing request (%s) ret=%d\r\n", req, ret);
+ DBG("Parsing request (%s) ret=%d\r\n", req, ret);
*request = string(req);
@@ -129,11 +136,11 @@
void StreamRequestDispatcher::onTcpSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nStreamRequestDispatcher Event %d\r\n", e);
+ DBG("Event %d\r\n", e);
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
@@ -186,29 +193,36 @@
{
int ret;
int i = 0;
- for(tClients::iterator it = m_lpClients.begin(); it != m_lpClients.end(); ++it)
+ tClients::iterator it;
+ for(it = m_lpClients.begin(); it != m_lpClients.end(); /* No increment here */ )
{
ret = (*it)->writeData(buf, len);
if (
ret == TCPSOCKET_RST // This is a safety valve. We should have self-removed from m_lpClients upon socket closure and not get here.
|| ret == TCPSOCKET_MEM // This probably means that network is not delivering packets, and we're backed up.
) {
-DBG("\r\nStreamServer::sendToAll(%s) - erasing socket %d\r\n", buf, i);
+ DBG("(%s) Socket error 0x%04X - erasing socket %d\r\n", buf, ret, i);
+ // delete below will remove (*it) from the list we are iterating in. Prepare for that
+ tClients::iterator it_next = it;
+ it_next++;
delete (*it);
-//? (*it) = NULL;
-//DBG("\r\nStreamServer::sendToAll() - erasing socket\r\n");
-//? it = m_lpClients.erase(it);
- continue;
+ it = it_next;
+ continue; // This ensures that for(...) above will continue properly.
}
i++;
+ it++; /* increment the iterator */
}
-DBG("\r\nStreamServer::sendToAll(%s) - %d sockets\r\n", buf, i);
+}
+
+int StreamServer::countClients(void)
+{
+ return m_lpClients.size();
}
void StreamServer::onTcpSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nStreamServer::onTcpSocketEvent : Event %d\r\n", e);
+ DBG("Event %d\r\n", e);
if(e==TCPSOCKET_ACCEPT)
{
@@ -217,7 +231,7 @@
if( !!m_pTcpSocket->accept(&client, &pTcpSocket) )
{
- DBG("\r\nStreamServer::onTcpSocketEvent : Could not accept connection.\r\n");
+ DBG("Could not accept connection.\r\n");
return; //Error in accept, discard connection
}
@@ -226,3 +240,5 @@
m_lpClients.push_back(pDispatcher);
}
}
+
+//END
\ No newline at end of file
diff -r e614f7875b60 -r 3ee499525aa5 StreamServer.h --- a/StreamServer.h Sat Jun 12 06:01:50 2010 +0000 +++ b/StreamServer.h Mon Jun 14 03:24:33 2010 +0000 @@ -49,6 +49,7 @@ void bind(int port = 123); void sendToAll(const char* buf, int len); + int countClients(void); private: friend class StreamRequestDispatcher;
diff -r e614f7875b60 -r 3ee499525aa5 dbg/dbg.cpp
--- a/dbg/dbg.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/dbg/dbg.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -26,22 +26,69 @@
#include "dbg.h"
#include "mbed.h"
#include <cstdarg>
+#include "string.h"
//LocalFileSystem dbgfs("dbgsfs");
//static FILE* m_fp = NULL;
+static int strpos (const char *haystack, const char *seed) {
+ int pos;
+ const char *pos_char = haystack;
+ const char *seed_char = seed;
+ while (*pos_char != 0) {
+ while (*pos_char != 0 && *seed_char != 0 && *pos_char == *seed_char) {
+ pos_char++;
+ seed_char++;
+ }
+ if (*seed_char == 0) {
+ return pos; // We reached the end of seed and matched.
+ }
+ pos++;
+ pos_char = haystack + pos;
+ seed_char = seed;
+ }
+ return -1; // not found
+}
void DebugStream::debug(const char* format, ...)
{
// if(!m_fp)
// m_fp = fopen("/dbgsfs/dbg.txt", "a");
-
va_list argp;
va_start(argp, format);
+#if 0 // DEBUG_FIXLF
vprintf(format, argp);
//vfprintf(m_fp, format, argp);
va_end(argp);
+#else
+ int len;
+ char buf[512];
+ len = vsprintf(buf, format, argp);
+ if (buf[len-1] == '\n' && buf[len-2] != '\r') {
+ // Fix CR without LF
+ buf[len-1] = '\r';
+ buf[len] = '\n';
+ buf[len+1] = '\0';
+ len++;
+ }
+ if (len >= (sizeof(buf)/sizeof(buf[0]))) {
+ printf("DebugStream::debug() buffer overflow (len=%d).\r\n", len);
+ }
+ if (WHERECHOP) {
+ int pos = strpos(format, WHEREFMT);
+ if (pos >= 0) {
+ char *from = buf+pos+WHERECHOP;
+ char *to = buf +WHERESKIP;
+ while (*from != 0) {
+ *(to++) = *(from++);
+ }
+ *(to) = 0;
+ }
+ }
+ va_end(argp);
+ printf(buf);
+#endif
// printf("\r\n"); //Flush
//local("local"); // Create the local filesystem under the name "local"
@@ -66,3 +113,4 @@
return strlen(str);
}
*/
+
diff -r e614f7875b60 -r 3ee499525aa5 dbg/dbg.h --- a/dbg/dbg.h Sat Jun 12 06:01:50 2010 +0000 +++ b/dbg/dbg.h Mon Jun 14 03:24:33 2010 +0000 @@ -47,14 +47,36 @@ #undef DBG_END #define DBG DebugStream::debug #define DBG_END DebugStream::release -#endif +// more informative debug messages. +#if 1 +#define WHEREFMT "[%s : %d : %s()] " +#define WHEREARG __FILE__, __LINE__, __FUNCTION__ +// __FILE__ starts with a long pathname, we're interested in the tail +#define WHERECHOP 64 // How many chars to chop in the WHEREFMT +#define WHERESKIP 1 // What position to start in WHEREFMT #else +#define WHEREFMT "[%s : %d] " +#define WHEREARG __FILE__, __LINE__ +// __FILE__ starts with a long pathname, we're interested in the tail +#define WHERECHOP 64 // How many chars to chop in the WHEREFMT +#define WHERESKIP 1 // What position to start in WHEREFMT +#endif +#undef DBG +#define DBG(_fmt, args...) DebugStream::debug(WHEREFMT _fmt, WHEREARG, ##args) +#undef DBGFIXLF +#define DBGFIXLF(_fmt, args...) DebugStream::debug(WHEREFMT _fmt, WHEREARG, ##args) + +#endif // __DEBUGSTREAM + +#else // __DEBUG #undef DBG #undef DBG_END #define DBG(...) #define DBG_END() -#endif +#undef DBGFIXLF +#define DBGFIXLF(...) +#endif // __DEBUG #ifdef __LWIP_DEBUG #ifndef __SNPRINTF @@ -62,12 +84,11 @@ #include "mbed.h" //int snprintf(char *str, int size, const char *format, ...); -#endif -#endif +#endif // __SNPRINTF +#endif // __LWIP_DEBUG #ifdef __LWIP_DEBUG #undef __DEBUG #endif -//#endif - +//#endif // DBG_H
diff -r e614f7875b60 -r 3ee499525aa5 drv/at/ATIf.cpp
--- a/drv/at/ATIf.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/drv/at/ATIf.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -71,7 +71,7 @@
len += vsprintf(m_tmpBuf, format, argp);
va_end(argp);
- //DBG("\r\nOutBuf is : %s, mode is %d.", m_tmpBuf, m_lineMode);
+ //DBG("OutBuf is : %s, mode is %d.", m_tmpBuf, m_lineMode);
int err = write( m_tmpBuf, m_lineMode );
if (err<0)
@@ -162,7 +162,7 @@
ATErr ATIf::open(Serial* pSerial) //Deactivate echo, etc
{
- DBG("\r\nOpening...");
+ DBG("Opening...");
m_isOpen = true; //Must be set so that the serial port-related fns work
//Setup options
// pSerial->baud(BAUDRATE); //FIXME
@@ -172,14 +172,14 @@
setTimeout(1000);
setLineMode(true); //Line Mode
- DBG("\r\nTrmt...");
+ DBG("Trmt...");
// printf("AT+IPR=%d", BAUDRATE); //FIXME
wait(.100);
printf("ATE"); //Deactivate echo
wait(.500);
flushBuffer();
- DBG("\r\nATE OK.");
+ DBG("ATE OK.");
int len = writeLine("ATV1");
ATErr err = AT_OK;
@@ -191,7 +191,7 @@
err = checkOK();
if (err) //No ACK from module
{
- DBG("\r\nOpening port, error %d.", err);
+ DBG("Opening port, error %d.", err);
if(err==AT_TIMEOUT)
err = AT_NOANSWER;
}
@@ -204,7 +204,7 @@
return err;
}
- DBG("\r\nNo error.");
+ DBG("No error.");
#if 0//FIXME
m_signalsEnable = true;
#endif
@@ -217,7 +217,7 @@
#if NET_USB_SERIAL
ATErr ATIf::open(UsbSerial* pUsbSerial) //Deactivate echo, etc
{
- DBG("\r\nOpening...");
+ DBG("Opening...");
m_isOpen = true; //Must be set so that the serial port-related fns work
//Setup options
SerialBuf::attach(pUsbSerial);
@@ -234,7 +234,7 @@
wait(.500);
flushBuffer();
- DBG("\r\nATE OK.");
+ DBG("ATE OK.");
int len = writeLine("ATQ0 V1 S0=0 &C1 &D2 +FCLASS=0");//writeLine("ATQ0 V1 S0=0 &C1 &D2 +FCLASS=0");
ATErr err = AT_OK;
@@ -246,7 +246,7 @@
err = checkOK();
if (err) //No ACK from module
{
- DBG("\r\nOpening port, error %d.", err);
+ DBG("Opening port, error %d.", err);
if(err==AT_TIMEOUT)
err = AT_NOANSWER;
}
@@ -259,7 +259,7 @@
return err;
}
- DBG("\r\nNo error.");
+ DBG("No error.");
m_signalsEnable = true;
//FIXME:
// m_pSerial->attach<ATIf>(this, &ATIf::onSerialInterrupt);
@@ -286,12 +286,12 @@
while(readable())
{
/* c = */ getc();
- // DBG("\r\n[%c] discarded.", c);
+ // DBG("[%c] discarded.", c);
// wait(0.01);
len++;
}
- DBG("\r\n%d chars discarded.", len);
+ DBG("%d chars discarded.", len);
return AT_OK;
}
@@ -330,7 +330,7 @@
}
}
-// DBG("\r\n%d chars discarded.", len);
+// DBG("%d chars discarded.", len);
return AT_OK;
}
@@ -381,7 +381,7 @@
ATErr ATIf::rawOpen(Serial* pSerial, int baudrate) //Simple open function for similar non-conforming protocols
{
- DBG("\r\nOpening...");
+ DBG("Opening...");
m_isOpen = true; //Must be set so that the serial port-related fns work
//Setup options
pSerial->baud(baudrate);
@@ -457,19 +457,19 @@
if(err<0)
{
- DBG("\r\nError in check (%s).\r\n", ret);
+ DBG("Error in check (%s).\r\n", ret);
flushBuffer(); //Discard anything in buf to avoid misparsing in the following calls
return (ATErr)err;
}
if(!!strcmp("OK",ret))
{
- DBG("\r\nNot an OK <%s>.\r\n", ret);
+ DBG("Not an OK <%s>.\r\n", ret);
flushBuffer();
return AT_ERROR;
}
- DBG("\r\nCHECK OK\r\n");
+ DBG("CHECK OK\r\n");
return AT_OK;
}
@@ -723,7 +723,7 @@
int len = scanf("%[^:]:%*[^\n]", sigName);
if(len != 1)
return false; //This is not a signal
- // DBG("\r\nGot signal %s\r\n", sigName);
+ // DBG("Got signal %s\r\n", sigName);
list<ATSigHandler>::iterator it;
@@ -731,7 +731,7 @@
{
if( !strcmp((*it).m_name, sigName) )
{
- // DBG("\r\nFound signal %s\r\n", sigName);
+ // DBG("Found signal %s\r\n", sigName);
m_pCurrentSignal = &(*it);
beg = true;
break;
diff -r e614f7875b60 -r 3ee499525aa5 drv/gprs/GPRSModem.cpp
--- a/drv/gprs/GPRSModem.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/drv/gprs/GPRSModem.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -61,33 +61,33 @@
int netState = 0;
int len;
len = ATIf::printf("AT+CREG?"); //Registered ?
- if(!len) DBG("\r\nprintf - len=%d\r\n",len);
+ if(!len) DBG("printf - len=%d\r\n",len);
if(!len)
return GPRS_MODEM; //Nothing was actually sent
len = ATIf::scanf("+CREG: 0,%d", &netState); //Get status
- if(len != 1) DBG("\r\nscanf - len=%d\r\n",len);
+ if(len != 1) DBG("scanf - len=%d\r\n",len);
if(len != 1) //Likely +CMS ERROR was returned
return GPRS_MODEM;
if( !!ATIf::checkOK() ) //Should not be a problem
- {DBG("\r\nNOK\r\n"); return GPRS_MODEM; }
+ {DBG("NOK\r\n"); return GPRS_MODEM; }
switch(netState)
{
case 1:
case 5: //TODO: Option allow roaming
- DBG("\r\nNetwork is up!\r\n");
+ DBG("Network is up!\r\n");
return GPRS_OK;
case 3:
- DBG("\r\nAccess to network denied.\r\n");
+ DBG("Access to network denied.\r\n");
return GPRS_DENIED;
case 0:
- DBG("\r\nNo network.\r\n");
+ DBG("No network.\r\n");
return GPRS_NONETWORK;
case 4:
case 2:
- //DBG("\r\nRegistering...\r\n");
+ //DBG("Registering...\r\n");
return GPRS_REGISTERING;
}
@@ -134,7 +134,7 @@
return GPRS_MODEM; //Nothing was actually sent
len = ATIf::scanf("+CGREG: %*d,%d", &netState); //Get GPRS status, see GSM 07.07 spec as Telit AT ref is wrong
- if(len != 1) DBG("\r\nscanf - len=%d\r\n",len);
+ if(len != 1) DBG("scanf - len=%d\r\n",len);
if(len != 1) //Likely +CMS ERROR was returned
return GPRS_MODEM;
@@ -145,17 +145,17 @@
{
case 1:
case 5: //TODO: Option allow roaming
- DBG("\r\nNetwork is up!\r\n");
+ DBG("Network is up!\r\n");
return GPRS_OK;
case 3:
- DBG("\r\nAccess to network denied.\r\n");
+ DBG("Access to network denied.\r\n");
return GPRS_DENIED;
case 0:
- DBG("\r\nNo network.\r\n");
+ DBG("No network.\r\n");
return GPRS_NONETWORK;
case 4:
case 2:
- DBG("\r\nRegistering...\r\n");
+ DBG("Registering...\r\n");
return GPRS_REGISTERING;
}
@@ -172,7 +172,7 @@
if(err)
return err;
- DBG("\r\nAttaching GPRS...\r\n");
+ DBG("Attaching GPRS...\r\n");
ATIf::setReadMode(false); //Discard chars
ATIf::setTimeout(10000);
ATIf::setLineMode(true); //Line mode
@@ -202,7 +202,7 @@
GPRSErr GPRSModem::setGPRSDown()
{
ATIf::flushBuffer();
- DBG("\r\nDetaching GPRS...\r\n");
+ DBG("Detaching GPRS...\r\n");
ATIf::setReadMode(false); //Discard chars
ATIf::setTimeout(10000);
ATIf::setLineMode(true); //Line mode
@@ -228,7 +228,7 @@
ATIf::setTimeout(5000);
ATIf::setLineMode(true); //Line mode
- DBG("\r\nConnecting...\r\n");
+ DBG("Connecting...\r\n");
int len;
@@ -262,7 +262,7 @@
ATIf::setSignals(false);
- DBG("\r\nConnected.\r\n");
+ DBG("Connected.\r\n");
return GPRS_OK; //Time to enter a PPP Session !
@@ -283,7 +283,7 @@
if(err)
return err;
- DBG("\r\nDisconnected.\r\n");
+ DBG("Disconnected.\r\n");
return GPRS_OK;
}
diff -r e614f7875b60 -r 3ee499525aa5 drv/serial/buf/SerialBuf.cpp
--- a/drv/serial/buf/SerialBuf.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/drv/serial/buf/SerialBuf.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -89,7 +89,7 @@
void SerialBuf::onSerialInterrupt() //Callback from m_pSerial
{
- //DBG("\r\n[INT]");
+ //DBG("[INT]");
// Timer tmr;
// tmr.start();
// static volatile bool incompleteData = true;
@@ -106,7 +106,7 @@
len++;
#ifdef __DEBUGVERBOSE
char c = m_pStream(getc());
- DBG("\r\n[%c]",c);
+ DBG("[%c]",c);
put(c);
#else
put(m_pStream(getc()));
@@ -114,11 +114,11 @@
}
else
{
- DBG("\r\nWARN: SerialBuf Overrun");
+ DBG("WARN: SerialBuf Overrun");
m_pStream(getc());
}
} while(m_pStream(readable()));
- // DBG("\r\n[/INT]=*%d*\r\n w len=*%d*",tmr.read_us(),len);
+ // DBG("[/INT]=*%d*\r\n w len=*%d*",tmr.read_us(),len);
if( m_intCanReadData )
{
@@ -158,18 +158,18 @@
char SerialBuf::getc()
{
-// DBG("\r\n\[GETC]");
+// DBG("[GETC]");
#if 0
if(m_trmt) //Was transmitting
{
- DBG("\r\n<\r\n");
+ DBG("<\r\n");
m_trmt=false;
}
#endif
char c;
c = get();
DBG("%c", c);
-// DBG("\r\n[/GETC]");
+// DBG("[/GETC]");
return c;
}
@@ -178,7 +178,7 @@
#if 0
if(!m_trmt) //Was receiving
{
- DBG("\r\n>\r\n");
+ DBG(">\r\n");
m_trmt=true;
}
#endif
@@ -186,7 +186,7 @@
// while(!m_pSerial->writeable() /*|| m_pSerial->readable()*/)
// {
// wait_us(100);
-// DBG("\r\nWait...\r\n");
+// DBG("Wait...\r\n");
// }
/*
NVIC_DisableIRQ(UART1_IRQn);
@@ -207,7 +207,7 @@
bool SerialBuf::readable()
{
// onSerialInterrupt(); //Flush hw buffer into current buf
- // DBG("\r\nLen=%d",len());
+ // DBG("Len=%d",len());
return (len()>0);
}
diff -r e614f7875b60 -r 3ee499525aa5 if/eth/EthernetNetIf.cpp
--- a/if/eth/EthernetNetIf.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/eth/EthernetNetIf.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -76,21 +76,21 @@
m_pNetIf->hwaddr_len = ETHARP_HWADDR_LEN; //6
eth_address((char *)m_pNetIf->hwaddr);
- DBG("\r\nHW Addr is : %02x:%02x:%02x:%02x:%02x:%02x.\r\n",
+ DBG("HW Addr is : %02x:%02x:%02x:%02x:%02x:%02x.\r\n",
m_pNetIf->hwaddr[0], m_pNetIf->hwaddr[1], m_pNetIf->hwaddr[2],
m_pNetIf->hwaddr[3], m_pNetIf->hwaddr[4], m_pNetIf->hwaddr[5]);
- DBG("\r\nIn Setup.\r\n");
+ DBG("In Setup.\r\n");
m_pNetIf = netif_add(m_pNetIf, &(m_ip.getStruct()), &(m_netmask.getStruct()), &(m_gateway.getStruct()), NULL, eth_init, ip_input);//ethernet_input);// ip_input);
//m_pNetIf->hostname = "mbedDG";//(char *)m_hostname; //Not used for now
netif_set_default(m_pNetIf);
- //DBG("\r\nStarting DHCP.\r\n");
+ //DBG("Starting DHCP.\r\n");
if(m_useDhcp)
{
dhcp_start(m_pNetIf);
- DBG("\r\nDHCP Started, waiting for IP...\r\n");
+ DBG("DHCP Started, waiting for IP...\r\n");
}
else
{
@@ -109,14 +109,14 @@
dhcp_stop(m_pNetIf);
else
netif_set_down(m_pNetIf);
- DBG("\r\nTimeout.\r\n");
+ DBG("Timeout.\r\n");
return ETH_TIMEOUT;
}
}
m_ip = IpAddr(&(m_pNetIf->ip_addr));
- DBG("\r\nConnected, IP : %d.%d.%d.%d\r\n", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
+ DBG("Connected, IP : %d.%d.%d.%d\r\n", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
return ETH_OK;
}
diff -r e614f7875b60 -r 3ee499525aa5 if/lwip/lwipNetTcpSocket.cpp
--- a/if/lwip/lwipNetTcpSocket.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/lwip/lwipNetTcpSocket.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -33,7 +33,7 @@
LwipNetTcpSocket::LwipNetTcpSocket(tcp_pcb* pPcb /*= NULL*/) : m_pPcb(pPcb), m_lpInNetTcpSocket(), //Passes a pcb if already created (by an accept req for instance), in that case transfers ownership
m_pReadPbuf(NULL)
{
- DBG("\r\nNew NetTcpSocket %p\r\n", (void*)this);
+ DBG("New NetTcpSocket %p\r\n", (void*)this);
if(!m_pPcb)
m_pPcb = tcp_new();
if(m_pPcb)
@@ -46,7 +46,7 @@
tcp_err( (tcp_pcb*) m_pPcb, LwipNetTcpSocket::sErrCb );
//Connected callback is defined in connect()
//Accept callback is defined in listen()
- DBG("\r\nNetTcpSocket created.\r\n");
+ DBG("NetTcpSocket created.\r\n");
}
}
@@ -156,7 +156,7 @@
/* if(*ppNewNetTcpSocket == NULL)
{
- DBG("\r\nNot enough mem, socket dropped in LwipNetTcpSocket::accept.\r\n");
+ DBG("Not enough mem, socket dropped in LwipNetTcpSocket::accept.\r\n");
tcp_abort(pInPcb);
}*/
@@ -253,7 +253,7 @@
NetTcpSocketErr LwipNetTcpSocket::close()
{
- //DBG("\r\nLwipNetTcpSocket::close() : Closing...\r\n");
+ //DBG("Closing...\r\n");
if(m_closed)
return NETTCPSOCKET_OK; //Already being closed
@@ -267,13 +267,13 @@
if( !!tcp_close( (tcp_pcb*) m_pPcb) )
{
- DBG("\r\nLwipNetTcpSocket::close() could not close properly, abort.\r\n");
+ DBG("could not close properly, abort.\r\n");
tcp_abort( (tcp_pcb*) m_pPcb);
m_pPcb = NULL;
return NETTCPSOCKET_MEM;
}
- DBG("\r\nLwipNetTcpSocket::close() : connection closed successfully.\r\n");
+ DBG("connection closed successfully.\r\n");
m_pPcb = NULL;
return NETTCPSOCKET_OK;
@@ -291,7 +291,7 @@
{
if(err)
{
- DBG("\r\nError %d in LwipNetTcpSocket::acceptCb.\r\n", err);
+ DBG("Error %d in LwipNetTcpSocket::acceptCb.\r\n", err);
return err;
}
//FIXME: MEM Errs
@@ -300,7 +300,7 @@
if(pNewNetTcpSocket == NULL)
{
- DBG("\r\nNot enough mem, socket dropped in LwipNetTcpSocket::acceptCb.\r\n");
+ DBG("Not enough mem, socket dropped in LwipNetTcpSocket::acceptCb.\r\n");
tcp_abort(newpcb);
return ERR_ABRT;
}
@@ -322,7 +322,7 @@
void LwipNetTcpSocket::errCb(err_t err)
{
- DBG("\r\nNetTcpSocket %p - Error %d in LwipNetTcpSocket::errCb.\r\n", (void*)this, err);
+ DBG("NetTcpSocket %p - Error %d in LwipNetTcpSocket::errCb.\r\n", (void*)this, err);
//WARN: At this point, m_pPcb has been freed by lwIP
m_pPcb = NULL;
//These errors are fatal, discard all events queued before so that the errors are handled first
@@ -337,7 +337,7 @@
err_t LwipNetTcpSocket::sentCb(tcp_pcb* tpcb, u16_t len)
{
-// DBG("\r\n%d bytes ACKed by host.\r\n", len);
+// DBG("%d bytes ACKed by host.\r\n", len);
queueEvent(NETTCPSOCKET_WRITEABLE);
return ERR_OK;
}
@@ -345,7 +345,7 @@
err_t LwipNetTcpSocket::recvCb(tcp_pcb* tpcb, pbuf *p, err_t err)
{
//Store pbuf ptr
- // DBG("\r\nReceive CB with err = %d & len = %d.\r\n", err, p->tot_len);
+ // DBG("Receive CB with err = %d & len = %d.\r\n", err, p->tot_len);
// tcp_recved( (tcp_pcb*) m_pPcb, p->tot_len); //Acknowledge the reception
if(err)
@@ -355,7 +355,7 @@
}
else if(!p)
{
- DBG("\r\nNetTcpSocket %p - Connection closed by remote host (LwipNetTcpSocket::recvCb).\r\n", (void*)this);
+ DBG("NetTcpSocket %p - Connection closed by remote host (LwipNetTcpSocket::recvCb).\r\n", (void*)this);
//Buf is NULL, that means that the connection has been closed by remote host
//FIX: 27/05/2010: We do not want to deallocate the socket while some data might still be readable
@@ -398,7 +398,7 @@
if( m_pReadPbuf )
{
- DBG("\r\nDeallocating unread data.\r\n");
+ DBG("Deallocating unread data.\r\n");
pbuf_free((pbuf*)m_pReadPbuf); //Free all unread data
m_pReadPbuf = NULL;
recv(NULL,0); //Update recv ptr position
@@ -423,7 +423,7 @@
{
if( !arg )
{
- DBG("\r\nNetTcpSocket - Error %d in LwipNetTcpSocket::sErrCb.\r\n", err);
+ DBG("NetTcpSocket - Error %d in LwipNetTcpSocket::sErrCb.\r\n", err);
return; //The socket has been destroyed, discard error
}
LwipNetTcpSocket* pMe = (LwipNetTcpSocket*) arg;
diff -r e614f7875b60 -r 3ee499525aa5 if/lwip/lwipNetUdpSocket.cpp
--- a/if/lwip/lwipNetUdpSocket.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/lwip/lwipNetUdpSocket.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -32,7 +32,7 @@
LwipNetUdpSocket::LwipNetUdpSocket(udp_pcb* pPcb /*= NULL*/) : m_pPcb(pPcb), m_lInPkt() //Passes a pcb if already created (by an accept req for instance), in that case transfers ownership
{
- DBG("\r\nNew NetUdpSocket %p\r\n", (void*)this);
+ DBG("New NetUdpSocket %p\r\n", (void*)this);
if(!m_pPcb)
m_pPcb = udp_new();
if(m_pPcb)
@@ -79,7 +79,7 @@
pbuf_free( p );
if(err)
return NETUDPSOCKET_SETUP; //Connection problem
- DBG("\r\n%d bytes sent in UDP Socket.\r\n", len);
+ DBG("%d bytes sent in UDP Socket.\r\n", len);
return len;
}
@@ -151,7 +151,7 @@
NetUdpSocketErr LwipNetUdpSocket::close()
{
- //DBG("\r\nLwipNetUdpSocket::close() : Closing...\r\n");
+ //DBG("LwipNetUdpSocket::close() : Closing...\r\n");
if(m_closed)
return NETUDPSOCKET_OK; //Already being closed
@@ -179,7 +179,7 @@
void LwipNetUdpSocket::recvCb(udp_pcb* pcb, struct pbuf* p, ip_addr_t* addr, u16_t port)
{
- DBG("\r\n Packet of length %d arrived in UDP Socket.\r\n", p->tot_len);
+ DBG(" Packet of length %d arrived in UDP Socket.\r\n", p->tot_len);
list<InPacket>::iterator it;
for ( it = m_lInPkt.begin(); it != m_lInPkt.end(); it++ )
{
diff -r e614f7875b60 -r 3ee499525aa5 if/net/net.cpp
--- a/if/net/net.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/net/net.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -186,12 +186,12 @@
void Net::registerNetTcpSocket(NetTcpSocket* pNetTcpSocket)
{
net().m_lpNetTcpSocket.push_back(pNetTcpSocket);
- DBG("\r\nNetTcpSocket [ + %p ] %d\r\n", (void*)pNetTcpSocket, net().m_lpNetTcpSocket.size());
+ DBG("NetTcpSocket [ + %p ] %d\r\n", (void*)pNetTcpSocket, net().m_lpNetTcpSocket.size());
}
void Net::unregisterNetTcpSocket(NetTcpSocket* pNetTcpSocket)
{
- DBG("\r\nNetTcpSocket [ - %p ] %d\r\n", (void*)pNetTcpSocket, net().m_lpNetTcpSocket.size() - 1);
+ DBG("NetTcpSocket [ - %p ] %d\r\n", (void*)pNetTcpSocket, net().m_lpNetTcpSocket.size() - 1);
if(!pNetTcpSocket->m_removed)
net().m_lpNetTcpSocket.remove(pNetTcpSocket);
}
@@ -199,12 +199,12 @@
void Net::registerNetUdpSocket(NetUdpSocket* pNetUdpSocket)
{
net().m_lpNetUdpSocket.push_back(pNetUdpSocket);
- DBG("\r\nNetUdpSocket [ + %p ] %d\r\n", (void*)pNetUdpSocket, net().m_lpNetUdpSocket.size());
+ DBG("NetUdpSocket [ + %p ] %d\r\n", (void*)pNetUdpSocket, net().m_lpNetUdpSocket.size());
}
void Net::unregisterNetUdpSocket(NetUdpSocket* pNetUdpSocket)
{
- DBG("\r\nNetUdpSocket [ - %p ] %d\r\n", (void*)pNetUdpSocket, net().m_lpNetUdpSocket.size() - 1);
+ DBG("NetUdpSocket [ - %p ] %d\r\n", (void*)pNetUdpSocket, net().m_lpNetUdpSocket.size() - 1);
if(!pNetUdpSocket->m_removed)
net().m_lpNetUdpSocket.remove(pNetUdpSocket);
}
diff -r e614f7875b60 -r 3ee499525aa5 if/net/netservice.cpp
--- a/if/net/netservice.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/net/netservice.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -30,18 +30,18 @@
NetService::NetService(bool owned /*= true*/) : m_closed(false), m_removed(false), m_owned(owned)
{
NetService::lpServices().push_back(this);
- DBG("\r\n[ + %p ] %d\r\n", (void*)this, lpServices().size());
+ DBG("[ + %p ] %d\r\n", (void*)this, lpServices().size());
}
NetService::~NetService()
{
- // DBG("\r\nService removed\r\n");
-// DBG("\r\nNow %d services running\r\n", lpServices().size()-1);
- DBG("\r\n[ - %p ] %d\r\n", (void*)this, lpServices().size()-1);
+ // DBG("Service removed\r\n");
+// DBG("Now %d services running\r\n", lpServices().size()-1);
+ DBG("[ - %p ] %d\r\n", (void*)this, lpServices().size()-1);
if((!m_owned) || (!m_removed)) //Destructor was not called by servicesPoll()
{
if(m_owned)
- DBG("\r\nWARN!!!Service removed in dtor!!!\r\n");
+ DBG("WARN!!!Service removed in dtor!!!\r\n");
NetService::lpServices().remove(this);
}
}
@@ -59,7 +59,7 @@
{
if( (*it)->m_owned && (*it)->m_closed )
{
- DBG("\r\nService %p is flagged as closed\r\n", &(*it));
+ DBG("Service %p is flagged as closed\r\n", &(*it));
(*it)->m_removed = true;
delete (*it);
it = lpServices().erase(it);
@@ -75,7 +75,7 @@
void NetService::close()
{
- DBG("\r\nService %p to be closed\r\n", this);
+ DBG("Service %p to be closed\r\n", this);
m_closed = true;
}
diff -r e614f7875b60 -r 3ee499525aa5 if/ppp/PPPNetIf.cpp
--- a/if/ppp/PPPNetIf.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/if/ppp/PPPNetIf.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -79,14 +79,14 @@
if(gprsErr)
return PPP_NETWORK;
- DBG("\r\nPPPNetIf: If Connected.\r\n");
+ DBG("If Connected.\r\n");
if( userId == NULL )
pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL);
else
pppSetAuth(PPPAUTHTYPE_PAP, userId, password); //TODO: Allow CHAP as well
- DBG("\r\nPPPNetIf: Set Auth.\r\n");
+ DBG("Set Auth.\r\n");
m_pIf->flushBuffer(); //Flush buffer before passing serial port to PPP
@@ -98,7 +98,7 @@
return PPP_PROTOCOL;
}
- DBG("\r\nPPPNetIf: PPP Started with res = %d.\r\n", res);
+ DBG("PPP Started with res = %d.\r\n", res);
m_fd = res;
m_connected = true;
@@ -109,13 +109,13 @@
poll();
if(t.read_ms()>PPP_TIMEOUT)
{
- DBG("\r\nPPPNetIf: Timeout.\r\n");
+ DBG("Timeout.\r\n");
disconnect();
return PPP_PROTOCOL;
}
}
- DBG("\r\nPPPNetIf: Callback returned.\r\n");
+ DBG("Callback returned.\r\n");
if( m_status == PPP_DISCONNECTED )
{
@@ -194,7 +194,7 @@
//Link Callback
void PPPNetIf::pppCallback(int errCode, void *arg)
{
- //DBG("\r\nPPPNetIf: Callback errCode = %d.\r\n", errCode);
+ //DBG("Callback errCode = %d.\r\n", errCode);
switch ( errCode )
{
//No error
diff -r e614f7875b60 -r 3ee499525aa5 lwip/arch/cc.h --- a/lwip/arch/cc.h Sat Jun 12 06:01:50 2010 +0000 +++ b/lwip/arch/cc.h Mon Jun 14 03:24:33 2010 +0000 @@ -33,7 +33,7 @@ //#error #endif -#define LWIP_PLATFORM_DIAG(x) DBG x +#define LWIP_PLATFORM_DIAG(x) DBGFIXLF x #define LWIP_PLATFORM_ASSERT(x) DBG(x) #define LWIP_PROVIDE_ERRNO
diff -r e614f7875b60 -r 3ee499525aa5 lwip/core/ipv4/autoip.c
--- a/lwip/core/ipv4/autoip.c Sat Jun 12 06:01:50 2010 +0000
+++ b/lwip/core/ipv4/autoip.c Mon Jun 14 03:24:33 2010 +0000
@@ -311,7 +311,7 @@
memset( autoip, 0, sizeof(struct autoip));
/* store this AutoIP client in the netif */
netif->autoip = autoip;
- LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip"));
+ LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip\n"));
} else {
autoip->state = AUTOIP_STATE_OFF;
autoip->ttw = 0;
diff -r e614f7875b60 -r 3ee499525aa5 lwip/include/lwip/debug.h
--- a/lwip/include/lwip/debug.h Sat Jun 12 06:01:50 2010 +0000
+++ b/lwip/include/lwip/debug.h Mon Jun 14 03:24:33 2010 +0000
@@ -63,7 +63,7 @@
#ifndef LWIP_NOASSERT
#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \
- LWIP_PLATFORM_ASSERT(message); } while(0)
+ LWIP_PLATFORM_ASSERT(message "\r\n"); } while(0)
#else /* LWIP_NOASSERT */
#define LWIP_ASSERT(message, assertion)
#endif /* LWIP_NOASSERT */
@@ -71,7 +71,7 @@
/** if "expression" isn't true, then print "message" and execute "handler" expression */
#ifndef LWIP_ERROR
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
- LWIP_PLATFORM_ASSERT(message); handler;}} while(0)
+ LWIP_PLATFORM_ASSERT(message "\r\n"); handler;}} while(0)
#endif /* LWIP_ERROR */
#ifdef LWIP_DEBUG
diff -r e614f7875b60 -r 3ee499525aa5 lwip/lwipopts.h
--- a/lwip/lwipopts.h Sat Jun 12 06:01:50 2010 +0000
+++ b/lwip/lwipopts.h Mon Jun 14 03:24:33 2010 +0000
@@ -66,7 +66,7 @@
#define NETIF_DEBUG LWIP_DBG_OFF
#define SOCKETS_DEBUG LWIP_DBG_OFF
#define DEMO_DEBUG LWIP_DBG_OFF
-#define IP_DEBUG LWIP_DBG_ON
+#define IP_DEBUG LWIP_DBG_OFF
#define IP_REASS_DEBUG LWIP_DBG_OFF
#define RAW_DEBUG LWIP_DBG_OFF
#define ICMP_DEBUG LWIP_DBG_OFF
@@ -127,7 +127,7 @@
#define MEMP_NUM_UDP_PCB 4
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
connections. */
-#define MEMP_NUM_TCP_PCB 3
+#define MEMP_NUM_TCP_PCB 8
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 2//4
diff -r e614f7875b60 -r 3ee499525aa5 netCfg.h --- a/netCfg.h Sat Jun 12 06:01:50 2010 +0000 +++ b/netCfg.h Mon Jun 14 03:24:33 2010 +0000 @@ -2,7 +2,7 @@ #define NET_CFG_H 1 //#define __LWIP_DEBUG -//#define __DEBUG +#define __DEBUG //Configure build params for TCP/IP Stack
diff -r e614f7875b60 -r 3ee499525aa5 services/email/smtp/SMTPClient.cpp
--- a/services/email/smtp/SMTPClient.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/email/smtp/SMTPClient.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -218,14 +218,14 @@
case TCPSOCKET_CONABRT:
case TCPSOCKET_ERROR:
onResult(SMTP_DISC);
- DBG("\r\nConnection error in SMTP Client.\r\n");
+ DBG("Connection error in SMTP Client.\r\n");
close();
break;
case TCPSOCKET_DISCONNECTED:
if(m_nextState != SMTP_BYE)
{
onResult(SMTP_DISC);
- DBG("\r\nConnection error in SMTP Client.\r\n");
+ DBG("Connection error in SMTP Client.\r\n");
close();
}
break;
diff -r e614f7875b60 -r 3ee499525aa5 services/http/client/HTTPClient.cpp
--- a/services/http/client/HTTPClient.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/client/HTTPClient.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -41,7 +41,7 @@
{
setTimeout(HTTP_REQUEST_TIMEOUT);
m_buf = new char[CHUNK_SIZE];
- DBG("\r\nNew HTTPClient %p\r\n",this);
+ DBG("New HTTPClient %p\r\n",this);
}
HTTPClient::~HTTPClient()
@@ -62,7 +62,7 @@
decStr += ":";
decStr += password;
auth.append( Base64::encode(decStr) );
- DBG("\r\nAuth str is %s\r\n", auth.c_str());
+ DBG("Auth str is %s\r\n", auth.c_str());
m_reqHeaders["Authorization"] = auth;
}
@@ -164,7 +164,7 @@
if( m_state == HTTP_DONE )
{
//All data has been read, close w/ success :)
- DBG("\r\nDone :)!\r\n");
+ DBG("Done :)!\r\n");
onResult(HTTP_OK);
close();
}
@@ -267,7 +267,7 @@
m_server.setPort( HTTP_PORT );
}
- DBG("\r\nURL parsed,\r\nHost: %s\r\nPort: %d\r\nPath: %s\r\n", url.getHost().c_str(), url.getPort(), url.getPath().c_str());
+ DBG("URL parsed,\r\nHost: %s\r\nPort: %d\r\nPath: %s\r\n", url.getHost().c_str(), url.getPort(), url.getPath().c_str());
IpAddr ip;
if( url.getHostIp(&ip) )
@@ -277,11 +277,11 @@
}
else
{
- DBG("\r\nDNS Query...\r\n");
+ DBG("DNS Query...\r\n");
m_pDnsReq = new DNSRequest();
m_pDnsReq->setOnReply(this, &HTTPClient::onDNSReply);
m_pDnsReq->resolve(&m_server);
- DBG("\r\nHTTPClient : DNSRequest %p\r\n", m_pDnsReq);
+ DBG("HTTPClient : DNSRequest %p\r\n", m_pDnsReq);
}
}
@@ -289,7 +289,7 @@
void HTTPClient::connect() //Start Connection
{
resetTimeout();
- DBG("\r\nConnecting...\r\n");
+ DBG("Connecting...\r\n");
m_pTCPSocket->connect(m_server);
}
@@ -352,7 +352,7 @@
m_state = HTTP_DONE;
return;
}
- DBG("\r\nReading response...\r\n");
+ DBG("Reading response...\r\n");
int len = 0;
do
{
@@ -360,7 +360,7 @@
{
if(m_dataLen==0)
{
- DBG("\r\nReading chunk length...\r\n");
+ DBG("Reading chunk length...\r\n");
//New block
static char chunkHeader[16];
//We use m_dataPos to retain the read position in chunkHeader, it has been set to 0 before the first call of readData()
@@ -370,19 +370,19 @@
if( chunkHeader[strlen(chunkHeader)-1] == 0x0d )
{
sscanf(chunkHeader, "%x%*[^\r\n]", &m_dataLen);
- DBG("\r\nChunk length is %d\r\n", m_dataLen);
+ DBG("Chunk length is %d\r\n", m_dataLen);
m_dataPos = 0;
}
else
{
//Wait for end of line
- DBG("\r\nWait for CRLF\r\n");
+ DBG("Wait for CRLF\r\n");
return;
}
}
else
{
- DBG("\r\nWait for data\r\n");
+ DBG("Wait for data\r\n");
//Wait for data
return;
}
@@ -405,17 +405,17 @@
{
if(m_dataPos >= m_dataLen)
{
- DBG("\r\nChunk read, wait for CRLF\r\n");
+ DBG("Chunk read, wait for CRLF\r\n");
char chunkTail[3];
m_dataPos += readLine(chunkTail, 3);
}
if(m_dataPos >= m_dataLen + 1) //1 == strlen("\n"),
{
- DBG("\r\nEnd of chunk\r\n");
+ DBG("End of chunk\r\n");
if(m_dataLen==0)
{
- DBG("\r\nEnd of file\r\n");
+ DBG("End of file\r\n");
//End of file
m_state = HTTP_DONE; //Done
}
@@ -429,7 +429,7 @@
if(!m_dataChunked && (m_dataPos >= m_dataLen)) //All Data has been received
{
- DBG("\r\nEnd of file\r\n");
+ DBG("End of file\r\n");
m_state = HTTP_DONE; //Done
}
}
@@ -471,11 +471,11 @@
void HTTPClient::onTCPSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nEvent %d in HTTPClient::onTCPSocketEvent()\r\n", e);
+ DBG("Event %d in HTTPClient::onTCPSocketEvent()\r\n", e);
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
@@ -498,18 +498,18 @@
m_dataChunked = true;
m_dataPos = 0;
m_dataLen = 0;
- DBG("\r\nEncoding is chunked, Content-Type is %s\r\n", m_respHeaders["Content-Type"].c_str() );
+ DBG("Encoding is chunked, Content-Type is %s\r\n", m_respHeaders["Content-Type"].c_str() );
}
else
{
m_dataChunked = false;
int len = 0;
- //DBG("\r\nPreparing read... len = %s\r\n", m_respHeaders["Content-Length"].c_str());
+ //DBG("Preparing read... len = %s\r\n", m_respHeaders["Content-Length"].c_str());
sscanf(m_respHeaders["Content-Length"].c_str(), "%d", &len);
m_pDataIn->setDataLen( len );
m_dataPos = 0;
m_dataLen = len;
- DBG("\r\nContent-Length is %d, Content-Type is %s\r\n", len, m_respHeaders["Content-Type"].c_str() );
+ DBG("Content-Length is %d, Content-Type is %s\r\n", len, m_respHeaders["Content-Type"].c_str() );
}
m_pDataIn->setDataType( m_respHeaders["Content-Type"] );
}
@@ -525,7 +525,7 @@
//All data has been read, close w/ success :)
if( m_state == HTTP_DONE )
{
- DBG("\r\nDone :)!\r\n");
+ DBG("Done :)!\r\n");
onResult(HTTP_OK);
}
break;
@@ -581,7 +581,7 @@
case TCPSOCKET_CONRST:
case TCPSOCKET_CONABRT:
case TCPSOCKET_ERROR:
- DBG("\r\nConnection error.\r\n");
+ DBG("Connection error.\r\n");
onResult(HTTP_CONN);
case TCPSOCKET_DISCONNECTED:
//There might still be some data available for reading
@@ -590,7 +590,7 @@
{
onResult(HTTP_CONN);
}
- DBG("\r\nConnection closed by remote host.\r\n");
+ DBG("Connection closed by remote host.\r\n");
break;
}
}
@@ -599,18 +599,18 @@
{
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
if( r != DNS_FOUND )
{
- DBG("\r\nCould not resolve hostname.\r\n");
+ DBG("Could not resolve hostname.\r\n");
onResult(HTTP_DNS);
return;
}
- DBG("\r\nDNS Resolved to %d.%d.%d.%d.\r\n",m_server.getIp()[0],m_server.getIp()[1],m_server.getIp()[2],m_server.getIp()[3]);
+ DBG("DNS Resolved to %d.%d.%d.%d.\r\n",m_server.getIp()[0],m_server.getIp()[1],m_server.getIp()[2],m_server.getIp()[3]);
//If no error, m_server has been updated by m_pDnsReq so we're set to go !
m_pDnsReq->close();
delete m_pDnsReq;
@@ -630,7 +630,7 @@
void HTTPClient::onTimeout() //Connection has timed out
{
- DBG("\r\nTimed out.\n");
+ DBG("Timed out.\n");
onResult(HTTP_TIMEOUT);
close();
}
@@ -668,7 +668,7 @@
if( sscanf(line, "HTTP/%*d.%*d %d %*[^\r\n]", &m_httpResponseCode) != 1 )
{
//Cannot match string, error
- DBG("\r\nNot a correct HTTP answer : %s\r\n", line);
+ DBG("Not a correct HTTP answer : %s\r\n", line);
onResult(HTTP_PRTCL);
close();
return false;
@@ -676,7 +676,7 @@
if(m_httpResponseCode != 200)
{
- DBG("\r\nResponse: error code %d\r\n", m_httpResponseCode);
+ DBG("Response: error code %d\r\n", m_httpResponseCode);
HTTPResult res = HTTP_ERROR;
switch(m_httpResponseCode)
{
@@ -693,12 +693,12 @@
close();
return false;
}
- DBG("\r\nResponse OK\r\n");
+ DBG("Response OK\r\n");
}
else
{
//Empty packet, weird!
- DBG("\r\nEmpty packet!\r\n");
+ DBG("Empty packet!\r\n");
onResult(HTTP_PRTCL);
close();
return false;
@@ -711,7 +711,7 @@
m_dataLen = 0;
if( readLen <= 2 ) //if == 1 or 2, it is an empty line = end of headers
{
- DBG("\r\nAll headers read.\r\n");
+ DBG("All headers read.\r\n");
m_state = HTTP_READ_DATA;
break;
}
@@ -720,11 +720,11 @@
m_dataLen = readLen;//Sets data length available in buffer
return false;
}
- //DBG("\r\nHeader : %s\r\n", line);
+ //DBG("Header : %s\r\n", line);
int n = sscanf(line, "%[^:] : %[^\r\n]", key, value);
if ( n == 2 )
{
- DBG("\r\nRead header : %s: %s\r\n", key, value);
+ DBG("Read header : %s: %s\r\n", key, value);
m_respHeaders[key] = value;
}
//TODO: Impl n==1 case (part 2 of previous header)
@@ -741,14 +741,14 @@
//Req
sprintf(line, "%s %s HTTP/1.1\r\nHost: %s\r\n", HTTP_METH_STR[m_meth], m_path.c_str(), m_server.getName()); //Write request
m_pTCPSocket->send(line, strlen(line));
- DBG("\r\nRequest: %s\r\n", line);
+ DBG("Request: %s\r\n", line);
- DBG("\r\nWriting headers:\r\n");
+ DBG("Writing headers:\r\n");
map<string,string>::iterator it;
for( it = m_reqHeaders.begin(); it != m_reqHeaders.end(); it++ )
{
sprintf(line, "%s: %s\r\n", (*it).first.c_str(), (*it).second.c_str() );
- DBG("\r\n%s", line);
+ DBG("%s", line);
m_pTCPSocket->send(line, strlen(line));
}
m_pTCPSocket->send("\r\n",2); //End of head
diff -r e614f7875b60 -r 3ee499525aa5 services/http/client/data/HTTPMap.cpp
--- a/services/http/client/data/HTTPMap.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/client/data/HTTPMap.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -116,7 +116,7 @@
Dictionary::erase(it); //Free memory as we process data
}
m_len = m_buf.length();
- DBG("\r\nData [len %d]:\r\n%s\r\n", m_len, m_buf.c_str());
+ DBG("Data [len %d]:\r\n%s\r\n", m_len, m_buf.c_str());
}
void HTTPMap::parseString()
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/HTTPRequestDispatcher.cpp
--- a/services/http/server/HTTPRequestDispatcher.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/HTTPRequestDispatcher.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -46,7 +46,7 @@
string meth;
HTTP_METH methCode;
- DBG("\r\nDispatching req\r\n");
+ DBG("Dispatching req\r\n");
if( !getRequest(&rootPath, &fullPath, &meth ) )
{
@@ -72,7 +72,7 @@
return;
}
- DBG("\r\nLooking for a handler\r\n");
+ DBG("Looking for a handler\r\n");
map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*) >::iterator it;
it = m_pSvr->m_lpHandlers.find(rootPath); //We are friends so we can do that
@@ -86,7 +86,7 @@
return;
}
- DBG("\r\nHandler found.\r\n");
+ DBG("Handler found.\r\n");
HTTPRequestHandler* pHdlr = (*it).second(rootPath.c_str(), fullPath.c_str(), m_pTCPSocket);
m_pTCPSocket = NULL; //We don't own it anymore
@@ -104,7 +104,7 @@
break;
}
- DBG("\r\nReq handled (or being handled)\r\n");
+ DBG("Req handled (or being handled)\r\n");
close();
}
@@ -162,7 +162,7 @@
}
*p = 0;
- DBG("\r\nParsing request : %s\r\n", req);
+ DBG("Parsing request : %s\r\n", req);
ret = sscanf(req, "%s %s HTTP/%*d.%*d", c_meth, c_path);
if(ret !=2)
@@ -180,7 +180,7 @@
*rootPath = string(c_path);
- DBG("\r\nParse OK :\r\nRoot Path : %s\r\nFull Path : %s\r\nMethod Path : %s\r\n", rootPath->c_str(), fullPath->c_str(), meth->c_str());
+ DBG("Parse OK :\r\nRoot Path : %s\r\nFull Path : %s\r\nMethod Path : %s\r\n", rootPath->c_str(), fullPath->c_str(), meth->c_str());
return true;
@@ -190,11 +190,11 @@
void HTTPRequestDispatcher::onTCPSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nEvent %d\r\n", e);
+ DBG("Event %d\r\n", e);
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/HTTPRequestHandler.cpp
--- a/services/http/server/HTTPRequestHandler.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/HTTPRequestHandler.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -146,7 +146,7 @@
int n = sscanf(line, "%[^:]: %[^\n]", key, value);
if ( n == 2 )
{
- DBG("\r\nRead header : %s : %s\r\n", key, value);
+ DBG("Read header : %s : %s\r\n", key, value);
m_reqHeaders[key] = value;
}
//TODO: Impl n==1 case (part 2 of previous header)
@@ -166,7 +166,7 @@
{
it = m_respHeaders.begin();
sprintf(line, "%s: %s\r\n", (*it).first.c_str(), (*it).second.c_str() );
- DBG("\r\n%s", line);
+ DBG("%s", line);
m_pTCPSocket->send(line, strlen(line));
m_respHeaders.erase(it);
}
@@ -205,11 +205,11 @@
void HTTPRequestHandler::onTCPSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nEvent %d in HTTPRequestHandler\r\n", e);
+ DBG("Event %d in HTTPRequestHandler\r\n", e);
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
@@ -228,7 +228,7 @@
case TCPSOCKET_CONABRT:
case TCPSOCKET_ERROR:
case TCPSOCKET_DISCONNECTED:
- DBG("\r\nConnection error in handler\r\n");
+ DBG("Connection error in handler\r\n");
close();
break;
}
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/HTTPServer.cpp
--- a/services/http/server/HTTPServer.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/HTTPServer.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -55,7 +55,7 @@
void HTTPServer::onTCPSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nHTTPServer::onTCPSocketEvent : Event %d\r\n", e);
+ DBG("Event %d\r\n", e);
if(e==TCPSOCKET_ACCEPT)
{
@@ -64,7 +64,7 @@
if( !!m_pTCPSocket->accept(&client, &pTCPSocket) )
{
- DBG("\r\nHTTPServer::onTCPSocketEvent : Could not accept connection.\r\n");
+ DBG("Could not accept connection.\r\n");
return; //Error in accept, discard connection
}
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/impl/FSHandler.cpp
--- a/services/http/server/impl/FSHandler.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/impl/FSHandler.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -38,12 +38,12 @@
{
if(m_fp)
fclose(m_fp);
- DBG("\r\nHandler destroyed\r\n");
+ DBG("Handler destroyed\r\n");
}
void FSHandler::doGet()
{
- DBG("\r\nIn FSHandler::doGet()\r\n");
+ DBG("In FSHandler::doGet()\r\n");
//FIXME: Translate path to local/path
m_fp = fopen(path().c_str(), "r"); //FIXME: if null, error 404
@@ -56,7 +56,7 @@
respHeaders()["Content-Type"] = "text/html";
respHeaders()["Connection"] = "close";
writeData(msg,strlen(msg)); //Only send header
- DBG("\r\nExit SimpleHandler::doGet() w Error 404\r\n");
+ DBG("Exit SimpleHandler::doGet() w Error 404\r\n");
return;
}
@@ -67,7 +67,7 @@
respHeaders()["Connection"] = "close";
onWriteable();
- DBG("\r\nExit SimpleHandler::doGet()\r\n");
+ DBG("Exit SimpleHandler::doGet()\r\n");
}
void FSHandler::doPost()
@@ -87,7 +87,7 @@
void FSHandler::onWriteable() //Data has been written & buf is free
{
- DBG("\r\nFSHandler::onWriteable() event\r\n");
+ DBG("FSHandler::onWriteable() event\r\n");
if(m_err404)
{
//Error has been served, now exit
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/impl/RPCHandler.cpp
--- a/services/http/server/impl/RPCHandler.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/impl/RPCHandler.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -34,25 +34,25 @@
RPCHandler::~RPCHandler()
{
- DBG("\r\nHandler destroyed\r\n");
+ DBG("Handler destroyed\r\n");
}
void RPCHandler::doGet()
{
- DBG("\r\nIn RPCHandler::doGet()\r\n");
+ DBG("In RPCHandler::doGet()\r\n");
char resp[RPC_DATA_LEN] = {0};
char req[RPC_DATA_LEN] = {0};
- DBG("\r\nPath : %s\r\n", path().c_str());
- DBG("\r\nRoot Path : %s\r\n", rootPath().c_str());
+ DBG("Path : %s\r\n", path().c_str());
+ DBG("Root Path : %s\r\n", rootPath().c_str());
//Remove path
strncpy(req, path().c_str() + rootPath().length(), RPC_DATA_LEN-1);
- DBG("\r\nRPC req : %s\r\n", req);
+ DBG("RPC req : %s\r\n", req);
//Remove %20, +, from req
cleanReq(req);
- DBG("\r\nRPC req : %s\r\n", req);
+ DBG("RPC req : %s\r\n", req);
//Do RPC Call
mbed::rpc(req, resp); //FIXME: Use bool result
@@ -69,7 +69,7 @@
//Write data
respHeaders()["Connection"] = "close";
writeData(resp, strlen(resp));
- DBG("\r\nExit RPCHandler::doGet()\r\n");
+ DBG("Exit RPCHandler::doGet()\r\n");
}
void RPCHandler::doPost()
@@ -90,7 +90,7 @@
void RPCHandler::onWriteable() //Data has been written & buf is free
{
- DBG("\r\nRPCHandler::onWriteable() event\r\n");
+ DBG("RPCHandler::onWriteable() event\r\n");
close(); //Data written, we can close the connection
}
diff -r e614f7875b60 -r 3ee499525aa5 services/http/server/impl/SimpleHandler.cpp
--- a/services/http/server/impl/SimpleHandler.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/http/server/impl/SimpleHandler.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -31,17 +31,17 @@
SimpleHandler::~SimpleHandler()
{
- DBG("\r\nHandler destroyed\r\n");
+ DBG("Handler destroyed\r\n");
}
void SimpleHandler::doGet()
{
- DBG("\r\nIn SimpleHandler::doGet()\r\n");
+ DBG("In SimpleHandler::doGet()\r\n");
const char* resp = "Hello world !";
setContentLen( strlen(resp) );
respHeaders()["Connection"] = "close";
writeData(resp, strlen(resp));
- DBG("\r\nExit SimpleHandler::doGet()\r\n");
+ DBG("Exit SimpleHandler::doGet()\r\n");
}
void SimpleHandler::doPost()
@@ -62,7 +62,7 @@
void SimpleHandler::onWriteable() //Data has been written & buf is free
{
- DBG("\r\nSimpleHandler::onWriteable() event\r\n");
+ DBG("SimpleHandler::onWriteable() event\r\n");
close(); //Data written, we can close the connection
}
diff -r e614f7875b60 -r 3ee499525aa5 services/mysql/MySQLClient.cpp
--- a/services/mysql/MySQLClient.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/mysql/MySQLClient.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -196,18 +196,18 @@
}
else //Need to do a DNS Query...
{
- DBG("\r\nDNS Query...\r\n");
+ DBG("DNS Query...\r\n");
m_pDnsReq = new DNSRequest();
m_pDnsReq->setOnReply(this, &MySQLClient::onDNSReply);
m_pDnsReq->resolve(&m_host);
- DBG("\r\nMySQLClient : DNSRequest %p\r\n", m_pDnsReq);
+ DBG("MySQLClient : DNSRequest %p\r\n", m_pDnsReq);
}
}
void MySQLClient::connect() //Start Connection
{
resetTimeout();
- DBG("\r\nConnecting...\r\n");
+ DBG("Connecting...\r\n");
m_pTCPSocket->connect(m_host);
m_packetId = 0;
}
@@ -442,11 +442,11 @@
void MySQLClient::onTCPSocketEvent(TCPSocketEvent e)
{
- DBG("\r\nEvent %d in MySQLClient::onTCPSocketEvent()\r\n", e);
+ DBG("Event %d in MySQLClient::onTCPSocketEvent()\r\n", e);
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
@@ -471,7 +471,7 @@
case TCPSOCKET_CONRST:
case TCPSOCKET_CONABRT:
case TCPSOCKET_ERROR:
- DBG("\r\nConnection error.\r\n");
+ DBG("Connection error.\r\n");
onResult(MYSQL_CONN);
case TCPSOCKET_DISCONNECTED:
//There might still be some data available for reading
@@ -480,7 +480,7 @@
{
onResult(MYSQL_CONN);
}
- DBG("\r\nConnection closed by remote host.\r\n");
+ DBG("Connection closed by remote host.\r\n");
break;
}
}
@@ -489,18 +489,18 @@
{
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
if( r != DNS_FOUND )
{
- DBG("\r\nCould not resolve hostname.\r\n");
+ DBG("Could not resolve hostname.\r\n");
onResult(MYSQL_DNS);
return;
}
- DBG("\r\nDNS Resolved to %d.%d.%d.%d.\r\n",m_host.getIp()[0],m_host.getIp()[1],m_host.getIp()[2],m_host.getIp()[3]);
+ DBG("DNS Resolved to %d.%d.%d.%d.\r\n",m_host.getIp()[0],m_host.getIp()[1],m_host.getIp()[2],m_host.getIp()[3]);
//If no error, m_host has been updated by m_pDnsReq so we're set to go !
m_pDnsReq->close();
delete m_pDnsReq;
@@ -521,7 +521,7 @@
void MySQLClient::onTimeout() //Connection has timed out
{
- DBG("\r\nTimed out.\n");
+ DBG("Timed out.\n");
onResult(MYSQL_DNS);
close();
}
diff -r e614f7875b60 -r 3ee499525aa5 services/ntp/NTPClient.cpp
--- a/services/ntp/NTPClient.cpp Sat Jun 12 06:01:50 2010 +0000
+++ b/services/ntp/NTPClient.cpp Mon Jun 14 03:24:33 2010 +0000
@@ -46,7 +46,7 @@
m_watchdog(), m_timeout(0), m_closed(true), m_host(), m_pDnsReq(NULL), m_blockingResult(NTP_PROCESSING)
{
setTimeout(NTP_REQUEST_TIMEOUT);
- DBG("\r\nNew NTPClient %p\r\n",this);
+ DBG("New NTPClient %p\r\n",this);
}
NTPClient::~NTPClient()
@@ -86,7 +86,7 @@
{
//DNS query required
m_pDnsReq = new DNSRequest();
- DBG("\r\nNTPClient : DNSRequest %p\r\n", m_pDnsReq);
+ DBG("NTPClient : DNSRequest %p\r\n", m_pDnsReq);
m_pDnsReq->setOnReply(this, &NTPClient::onDNSReply);
m_pDnsReq->resolve(&m_host);
return;
@@ -145,7 +145,7 @@
switch(m_state)
{
case NTP_PING:
- DBG("\r\nPing\r\n");
+ DBG("Ping\r\n");
//Prepare NTP Packet:
pkt.li = 0; //Leap Indicator : No warning
pkt.vn = 4; //Version Number : 4
@@ -166,12 +166,12 @@
pkt.refTm_f = pkt.origTm_f = pkt.rxTm_f = pkt.txTm_f = 0;
//Hex Dump:
- DBG("\r\nDump Tx:\r\n");
+ DBG("Dump Tx:\r\n");
for(int i = 0; i< sizeof(NTPPacket); i++)
{
DBG("%02x ", *((char*)&pkt + i));
}
- DBG("\r\n\r\n");
+ DBG("");
len = m_pUDPSocket->sendto( (char*)&pkt, sizeof(NTPPacket), &m_host );
if(len < sizeof(NTPPacket))
@@ -182,7 +182,7 @@
break;
case NTP_PONG:
- DBG("\r\nPong\r\n");
+ DBG("Pong\r\n");
while( len = m_pUDPSocket->recvfrom( (char*)&pkt, sizeof(NTPPacket), &host ) )
{
if( len <= 0 )
@@ -204,12 +204,12 @@
{ onResult(NTP_PRTCL); close(); return; }
//Hex Dump:
- DBG("\r\nDump Rx:\r\n");
+ DBG("Dump Rx:\r\n");
for(int i = 0; i< sizeof(NTPPacket); i++)
{
DBG("%02x ", *((char*)&pkt + i));
}
- DBG("\r\n\r\n");
+ DBG("");
if( pkt.stratum == 0) //Kiss of death message : Not good !
{
@@ -233,8 +233,8 @@
//int32_t txTm = (int32_t) ((uint64_t) pkt.txTm - NTP_TIMESTAMP_DELTA); //Convert in local 32 bits timestamps
// int64_t offset = ( ( ( pkt.rxTm_s - pkt.origTm_s ) + ( pkt.txTm_s - destTm_s ) ) << 32 + ( ( pkt.rxTm_f - pkt.origTm_f ) + ( pkt.txTm_f - 0 ) ) ) / 2;
int64_t offset = ( (int64_t)( pkt.rxTm_s - pkt.origTm_s ) + (int64_t) ( pkt.txTm_s - destTm_s ) ) / 2; //Avoid overflow
- DBG("\r\nSent @%d\r\n", pkt.txTm_s);
- DBG("\r\nOffset: %d\r\n", offset);
+ DBG("Sent @%d\r\n", pkt.txTm_s);
+ DBG("Offset: %d\r\n", offset);
//Set time accordingly
set_time( time(NULL) + (offset /*>> 32*/) );
@@ -267,13 +267,13 @@
{
if(m_closed)
{
- DBG("\r\nWARN: Discarded\r\n");
+ DBG("WARN: Discarded\r\n");
return;
}
if( r != DNS_FOUND )
{
- DBG("\r\nCould not resolve hostname.\r\n");
+ DBG("Could not resolve hostname.\r\n");
onResult(NTP_DNS);
close();
return;