From 3643b591091cb83262c09820242aeff9dcf8bc22 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 8 Dec 2016 16:14:15 -0600 Subject: [PATCH] nsapi - Fixed open/close issue in Socket During open, the socket checked the internal stack variable, assuming it would alway be null on a socket not connected to the network. However, when a socket is closed, the stack variable was not updated, causing the socket to incorrectly return a parameter error if reopened. The simple fix was to set the stack to null on close. A non-null stack is a predicate for a non-null socket variable, so no additional checks are needed in socket functions. --- features/netsocket/Socket.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/features/netsocket/Socket.cpp b/features/netsocket/Socket.cpp index 14ea797ec8..e96f8a2924 100644 --- a/features/netsocket/Socket.cpp +++ b/features/netsocket/Socket.cpp @@ -60,6 +60,7 @@ nsapi_error_t Socket::close() _socket = 0; ret = _stack->socket_close(socket); } + _stack = 0; // Wakeup anything in a blocking operation // on this socket