Skip to content

Commit ff2061a

Browse files
author
Mirela Chirica
committed
Cellular: Fix requested socket id in socket_connect routines of BG96 and M26
1 parent 9cc1caa commit ff2061a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularStack.cpp

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ nsapi_error_t QUECTEL_BG96_CellularStack::socket_connect(nsapi_socket_t handle,
5050
CellularSocket *socket = (CellularSocket *)handle;
5151

5252
int modem_connect_id = -1;
53-
int request_connect_id = socket->id;
5453
int err = -1;
5554

55+
int request_connect_id = find_socket_index(socket);
56+
// assert here as its a programming error if the socket container doesn't contain
57+
// specified handle
58+
MBED_ASSERT(request_connect_id != -1);
59+
5660
_at.lock();
5761
if (socket->proto == NSAPI_TCP) {
5862
_at.cmd_start("AT+QIOPEN=");

features/cellular/framework/targets/QUECTEL/M26/QUECTEL_M26_CellularStack.cpp

100644100755
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,14 @@ nsapi_error_t QUECTEL_M26_CellularStack::socket_connect(nsapi_socket_t handle, c
302302
{
303303
CellularSocket *socket = (CellularSocket *)handle;
304304

305-
MBED_ASSERT(socket->id != -1);
306-
307305
int modem_connect_id = -1;
308-
int request_connect_id = socket->id;
309306
int err = -1;
310307

308+
int request_connect_id = find_socket_index(socket);
309+
// assert here as its a programming error if the socket container doesn't contain
310+
// specified handle
311+
MBED_ASSERT(request_connect_id != -1);
312+
311313
_at.lock();
312314
if (socket->proto == NSAPI_TCP) {
313315
_at.cmd_start("AT+QIOPEN=");

0 commit comments

Comments
 (0)