Skip to content

Commit f512668

Browse files
Replaced rx_avail with pending_bytes
1 parent f9aaee5 commit f512668

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ void UBLOX_AT_CellularStack::UUSORD_URC()
5555

5656
socket = find_socket(a);
5757
if (socket != NULL) {
58-
socket->rx_avail = true;
5958
socket->pending_bytes = b;
6059
// No debug prints here as they can affect timing
6160
// and cause data loss in UARTSerial
@@ -76,7 +75,6 @@ void UBLOX_AT_CellularStack::UUSORF_URC()
7675

7776
socket = find_socket(a);
7877
if (socket != NULL) {
79-
socket->rx_avail = true;
8078
socket->pending_bytes = b;
8179
// No debug prints here as they can affect timing
8280
// and cause data loss in UARTSerial
@@ -198,7 +196,6 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_sendto_impl(CellularSocket
198196
fhs.events = POLLIN;
199197
int pollCount;
200198

201-
socket->rx_avail = false;
202199
if (socket->proto == NSAPI_UDP) {
203200
if (size > UBLOX_MAX_PACKET_SIZE) {
204201
return NSAPI_ERROR_PARAMETER;
@@ -273,9 +270,9 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
273270
int port = 0;
274271
Timer timer;
275272

276-
if (!socket->rx_avail) {
273+
if (socket->pending_bytes == 0) {
277274
_at.process_oob();
278-
if (!socket->rx_avail) {
275+
if (socket->pending_bytes == 0) {
279276
return NSAPI_ERROR_WOULD_BLOCK;
280277
}
281278
}
@@ -383,6 +380,7 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
383380
}
384381
timer.stop();
385382

383+
socket->pending_bytes = 0;
386384
if (!count || (_at.get_last_error() != NSAPI_ERROR_OK)) {
387385
return NSAPI_ERROR_WOULD_BLOCK;
388386
} else {
@@ -432,7 +430,7 @@ void UBLOX_AT_CellularStack::clear_socket(CellularSocket * socket)
432430
{
433431
if (socket != NULL) {
434432
socket->id = SOCKET_UNUSED;
435-
socket->rx_avail = 0;
433+
socket->pending_bytes = 0;
436434
socket->_cb = NULL;
437435
socket->_data = NULL;
438436
socket->created = false;

0 commit comments

Comments
 (0)