mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #8336 from sentinelt/socket-closed
Fix hard-fault when socket created using accept() is closedpull/8222/merge
commit
00f8ecfb7a
|
@ -222,6 +222,7 @@ TEST_F(TestInternetSocket, getsockopt)
|
|||
TEST_F(TestInternetSocket, sigio)
|
||||
{
|
||||
callback_is_called = false;
|
||||
socket->open((NetworkStack *)&stack);
|
||||
socket->sigio(mbed::callback(my_callback));
|
||||
socket->close(); // Trigger event;
|
||||
EXPECT_EQ(callback_is_called, true);
|
||||
|
|
|
@ -56,6 +56,10 @@ nsapi_error_t InternetSocket::close()
|
|||
_lock.lock();
|
||||
|
||||
nsapi_error_t ret = NSAPI_ERROR_OK;
|
||||
if (!_stack) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (_socket) {
|
||||
_stack->socket_attach(_socket, 0, 0);
|
||||
nsapi_socket_t socket = _socket;
|
||||
|
|
Loading…
Reference in New Issue