Socket::close() now supports an additional parameter for defining the shutdown type

Fork of Socket by mbed official

Files at this revision

API Documentation at this revision

Comitter:
marcelobarrosalmeida
Date:
Thu Mar 05 20:55:36 2015 +0000
Parent:
19:434906b5b977
Commit message:
Socket::close() now supports an additional parameter for defining the shutdown type

Changed in this revision

Socket.cpp Show annotated file Show diff for this revision Revisions of this file
Socket.h Show annotated file Show diff for this revision Revisions of this file
diff -r 434906b5b977 -r 6bf8566b40c8 Socket.cpp
--- a/Socket.cpp	Mon Aug 19 18:38:18 2013 +0300
+++ b/Socket.cpp	Thu Mar 05 20:55:36 2015 +0000
@@ -69,12 +69,12 @@
     return select(&timeout._time, false, true);
 }
 
-int Socket::close(bool shutdown) {
+int Socket::close(bool shutdown, int shutdown_type) {
     if (_sock_fd < 0)
         return -1;
     
     if (shutdown)
-        lwip_shutdown(_sock_fd, SHUT_RDWR);
+        lwip_shutdown(_sock_fd, shutdown_type);
     lwip_close(_sock_fd);
     _sock_fd = -1;
     
diff -r 434906b5b977 -r 6bf8566b40c8 Socket.h
--- a/Socket.h	Mon Aug 19 18:38:18 2013 +0300
+++ b/Socket.h	Thu Mar 05 20:55:36 2015 +0000
@@ -67,8 +67,9 @@
     
     /** Close the socket
         \param shutdown   free the left-over data in message queues
+        \param shutdown_type which channels will be closed (\ref SHUT_RD, \ref SHUT_WR or \ref SHUT_RDWR)
      */
-    int close(bool shutdown=true);
+    int close(bool shutdown=true, int shutdown_type=SHUT_RDWR);
     
     ~Socket();