Skip to content

Commit 02c7c0c

Browse files
Nels52Rocketct
authored andcommitted
Update src/GSMClient.cpp
Move set of GSMClient state to CLIENT_STATE_IDLE to the top of the stop() method so that the state is reset even if the _socket value is -1. This is necessary because the state can be left in CLIENT_STATE_WAIT_CREATE_SOCKET_RESPONSE state with _socket = -1 if the AT+USOCR= command hangs.
1 parent 39da63f commit 02c7c0c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GSMClient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ void GSMClient::flush()
421421

422422
void GSMClient::stop()
423423
{
424+
_state = CLIENT_STATE_IDLE;
425+
424426
if (_socket < 0) {
425427
return;
426428
}
@@ -429,7 +431,6 @@ void GSMClient::stop()
429431
MODEM.waitForResponse(10000);
430432

431433
GSMSocketBuffer.close(_socket);
432-
_state = CLIENT_STATE_IDLE;
433434
_socket = -1;
434435
_connected = false;
435436
}

0 commit comments

Comments
 (0)