Disable UDP + DHCP + DNS to reduce the amount of memory usage
Fork of Socket by
Revision 20:92677e486349, committed 2014-02-02
- Comitter:
- aos
- Date:
- Sun Feb 02 10:45:47 2014 +0000
- Parent:
- 19:434906b5b977
- Commit message:
- Disabled DHCP + DNS + UDP
Changed in this revision
diff -r 434906b5b977 -r 92677e486349 Endpoint.cpp --- a/Endpoint.cpp Mon Aug 19 18:38:18 2013 +0300 +++ b/Endpoint.cpp Sun Feb 02 10:45:47 2014 +0000 @@ -20,6 +20,7 @@ #include <cstring> #include <cstdio> + Endpoint::Endpoint() { reset_address(); } @@ -45,11 +46,13 @@ (unsigned int*)&address[2], (unsigned int*)&address[3]); if (result != 4) { + #if LWIP_DNS // Resolve address with DNS struct hostent *host_address = lwip_gethostbyname(host); if (host_address == NULL) return -1; //Could not resolve address p_address = (char*)host_address->h_addr_list[0]; + #endif } std::memcpy((char*)&_remoteHost.sin_addr.s_addr, p_address, 4);
diff -r 434906b5b977 -r 92677e486349 Socket.h --- a/Socket.h Mon Aug 19 18:38:18 2013 +0300 +++ b/Socket.h Sun Feb 02 10:45:47 2014 +0000 @@ -21,6 +21,7 @@ #include "lwip/sockets.h" #include "lwip/netdb.h" +#if LWIP_DNS //DNS inline struct hostent *gethostbyname(const char *name) { return lwip_gethostbyname(name); @@ -29,6 +30,7 @@ inline int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop) { return lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop); } +#endif class TimeInterval;
diff -r 434906b5b977 -r 92677e486349 UDPSocket.cpp --- a/UDPSocket.cpp Mon Aug 19 18:38:18 2013 +0300 +++ b/UDPSocket.cpp Sun Feb 02 10:45:47 2014 +0000 @@ -15,6 +15,7 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#if LWIP_UDP #include "Socket/UDPSocket.h" @@ -92,3 +93,5 @@ socklen_t remoteHostLen = sizeof(remote._remoteHost); return lwip_recvfrom(_sock_fd, buffer, length, 0, (struct sockaddr*) &remote._remoteHost, &remoteHostLen); } + +#endif