Team E1
Fork of HTTPServer by
Diff: HTTPServer.cpp
- Revision:
- 5:dc88012caef1
- Parent:
- 4:d065642c32cc
- Child:
- 6:fe661fa9d18a
--- a/HTTPServer.cpp Tue May 28 21:20:58 2013 +0000 +++ b/HTTPServer.cpp Sat Jun 01 06:24:43 2013 +0000 @@ -91,6 +91,7 @@ int HTTPServer::poll() { + int retval = -1; INFO("Listening for new connection requests."); // This thread basically checks if there is a new incoming connection. @@ -99,8 +100,19 @@ #ifdef _DEBUG led4 = 1; // Indicate we are waiting for a new connection -#endif - if (m_pSvr->accept(Clnt) < 0) { +#endif + m_pSvr->set_blocking(true); + retval = m_pSvr->accept(Clnt); + if (retval > 0) { + // no connection availale yet, so just return +#ifdef _DEBUG +led4 = 0; +led3 = 0; +led2 = 0; +#endif + return retval; + } + if ( retval < 0) { // an error occured ERR("There was an error, Accept returned with an error. Probably the connection to the router was lost. Shutting down server"); #ifdef _DEBUG