Safer to query the closed sock and get an error
This commit is contained in:
@@ -590,8 +590,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t modemGetAvailable(uint8_t mux) {
|
size_t modemGetAvailable(uint8_t mux) {
|
||||||
// Querying a closed socket gives an error "operation not allowed"
|
// NOTE: Querying a closed socket gives an error "operation not allowed"
|
||||||
if (!sockets[mux]->sock_connected) return 0;
|
|
||||||
sendAT(GF("+USORD="), mux, ",0");
|
sendAT(GF("+USORD="), mux, ",0");
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
uint8_t res = waitResponse(GF(GSM_NL "+USORD:"));
|
uint8_t res = waitResponse(GF(GSM_NL "+USORD:"));
|
||||||
@@ -610,8 +609,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool modemGetConnected(uint8_t mux) {
|
bool modemGetConnected(uint8_t mux) {
|
||||||
// Querying a closed socket gives an error "operation not allowed"
|
// NOTE: Querying a closed socket gives an error "operation not allowed"
|
||||||
if (!sockets[mux]->sock_connected) return false;
|
|
||||||
sendAT(GF("+USOCTL="), mux, ",10");
|
sendAT(GF("+USOCTL="), mux, ",10");
|
||||||
uint8_t res = waitResponse(GF(GSM_NL "+USOCTL:"));
|
uint8_t res = waitResponse(GF(GSM_NL "+USOCTL:"));
|
||||||
if (res != 1)
|
if (res != 1)
|
||||||
|
@@ -596,8 +596,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t modemGetAvailable(uint8_t mux) {
|
size_t modemGetAvailable(uint8_t mux) {
|
||||||
// Querying a closed socket gives an error "operation not allowed"
|
// NOTE: Querying a closed socket gives an error "operation not allowed"
|
||||||
if (!sockets[mux]->sock_connected) return 0;
|
|
||||||
sendAT(GF("+USORD="), mux, ",0");
|
sendAT(GF("+USORD="), mux, ",0");
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
uint8_t res = waitResponse(GF(GSM_NL "+USORD:"));
|
uint8_t res = waitResponse(GF(GSM_NL "+USORD:"));
|
||||||
@@ -616,8 +615,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool modemGetConnected(uint8_t mux) {
|
bool modemGetConnected(uint8_t mux) {
|
||||||
// Querying a closed socket gives an error "operation not allowed"
|
// NOTE: Querying a closed socket gives an error "operation not allowed"
|
||||||
if (!sockets[mux]->sock_connected) return false;
|
|
||||||
sendAT(GF("+USOCTL="), mux, ",10");
|
sendAT(GF("+USOCTL="), mux, ",10");
|
||||||
uint8_t res = waitResponse(GF(GSM_NL "+USOCTL:"));
|
uint8_t res = waitResponse(GF(GSM_NL "+USOCTL:"));
|
||||||
if (res != 1)
|
if (res != 1)
|
||||||
|
Reference in New Issue
Block a user