Skip to content

Commit 1234b3f

Browse files
author
Ari Parkkila
committed
Cellular: Fix UDP/IP on UBLOX_AT driver
1 parent d6f8fec commit 1234b3f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
251251

252252
timer.start();
253253
if (socket->proto == NSAPI_UDP) {
254-
while (success && (size > 0)) {
254+
bool packet_received = false;
255+
while (success && (size > 0 && !packet_received)) {
255256
read_blk = UBLOX_MAX_PACKET_SIZE;
256257
if (read_blk > size) {
257258
read_blk = size;
@@ -266,6 +267,8 @@ nsapi_size_or_error_t UBLOX_AT_CellularStack::socket_recvfrom_impl(CellularSocke
266267
usorf_sz = _at.read_int();
267268
if (usorf_sz > size) {
268269
usorf_sz = size;
270+
} else {
271+
packet_received = true;
269272
}
270273
_at.read_bytes(&ch, 1);
271274
_at.read_bytes((uint8_t *)buffer + count, usorf_sz);
@@ -453,7 +456,7 @@ nsapi_error_t UBLOX_AT_CellularStack::get_ip_address(SocketAddress *address)
453456
nsapi_error_t UBLOX_AT_CellularStack::gethostbyname(const char *host, SocketAddress *address, nsapi_version_t version, const char *interface_name)
454457
{
455458
char ipAddress[NSAPI_IP_SIZE];
456-
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
459+
nsapi_error_t err = NSAPI_ERROR_DNS_FAILURE;
457460

458461
_at.lock();
459462
if (address->set_ip_address(host)) {

0 commit comments

Comments
 (0)