Merge pull request #7052 from mirelachirica/bc95_sock_id_fix

Cellular: BC95 socket creation to fail on missing socket id in the re…
pull/7087/merge
Anna Bridge 2018-06-01 12:14:14 +01:00 committed by GitHub
commit b5b306ed50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -250,7 +250,10 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
_at.unlock();
if (ret_val != NSAPI_ERROR_OK) {
tr_error("Error creating socket to send to: %s error code: %d", addr.get_ip_address(), ret_val);
return ret_val;
} else {
tr_info("Success creating socket to send to: %s", addr.get_ip_address());
}
}
@ -265,6 +268,12 @@ nsapi_size_or_error_t AT_CellularStack::socket_sendto(nsapi_socket_t handle, con
_at.lock();
ret_val = socket_sendto_impl(socket, addr, data, size);
if (ret_val <= 0) {
tr_error("Error sending to: %s error code: %d", addr.get_ip_address(), ret_val);
} else {
tr_info("Success sending %d Bytes to: %s", ret_val, addr.get_ip_address());
}
_at.unlock();

View File

@ -119,7 +119,7 @@ nsapi_error_t QUECTEL_BC95_CellularStack::create_socket_impl(CellularSocket *soc
}
}
if (!socketOpenWorking) {
if (!socketOpenWorking || (sock_id == -1)) {
tr_error("Socket create failed!");
return NSAPI_ERROR_NO_SOCKET;
}