NetworkSocketAPI

Dependencies:   DnsQuery

Dependents:   HelloWizFi250Interface

Fork of NetworkSocketAPI by NetworkSocketAPI

Files at this revision

API Documentation at this revision

Comitter:
Christopher Haster
Date:
Tue Apr 19 18:23:12 2016 -0500
Parent:
90:0a988e4abb72
Child:
92:dd5f19874adf
Commit message:
Remove shutdown parameter from close call

Pros
- Simplifies interface
- Easier base implementation

Cons
- May need shutdown functionality, in this case shutdown
can be added as another function in the future

Changed in this revision

NetworkInterface.h Show annotated file Show diff for this revision Revisions of this file
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
--- a/NetworkInterface.h	Tue Apr 19 18:22:15 2016 -0500
+++ b/NetworkInterface.h	Tue Apr 19 18:23:12 2016 -0500
@@ -201,9 +201,8 @@
 
     /** Close the socket
      *  @param handle   Socket handle
-     *  @param shutdown free the left-over data in message queues
      */
-    virtual int socket_close(void *handle, bool shutdown) = 0;
+    virtual int socket_close(void *handle) = 0;
 
     /** Register a callback on when a new connection is ready
      *  @param handle   Socket handle
--- a/Socket.cpp	Tue Apr 19 18:22:15 2016 -0500
+++ b/Socket.cpp	Tue Apr 19 18:23:12 2016 -0500
@@ -27,7 +27,7 @@
 Socket::~Socket()
 {
     if (_socket) {
-        close(false);
+        close();
     }
 }
 
@@ -37,13 +37,13 @@
     _socket = _iface->socket_create(proto);
 }
 
-int Socket::close(bool shutdown)
+int Socket::close()
 {
     if (!_socket) {
         return 0;
     }
 
-    int err = _iface->socket_close(_socket, shutdown);
+    int err = _iface->socket_close(_socket);
     if (!err) {
         void *socket = _socket;
         _socket = 0;
--- a/Socket.h	Tue Apr 19 18:22:15 2016 -0500
+++ b/Socket.h	Tue Apr 19 18:23:12 2016 -0500
@@ -60,9 +60,8 @@
     int get_option(int optname, void *optval, unsigned *optlen);
     
     /** Close the socket
-     *  @param shutdown free the left-over data in message queues
      */
-    int close(bool shutdown=true);
+    int close();
 
 protected:
     Socket();