Skip to content

Commit

Permalink
Push 512 instead of 256 bytes, async socket close
Browse files Browse the repository at this point in the history
  • Loading branch information
CptHolzschnauz committed Aug 22, 2021
1 parent e94641f commit 00e8ae8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/NBClient.cpp
Expand Up @@ -165,7 +165,7 @@ int NBClient::ready()

case CLIENT_STATE_CLOSE_SOCKET: {

MODEM.sendf("AT+USOCL=%d", _socket);
MODEM.sendf("AT+USOCL=%d,1", _socket);

_state = CLIENT_STATE_WAIT_CLOSE_SOCKET;
ready = 0;
Expand Down Expand Up @@ -285,13 +285,13 @@ size_t NBClient::write(const uint8_t* buf, size_t size)
size_t written = 0;
String command;

command.reserve(19 + (size > 256 ? 256 : size) * 2);
command.reserve(19 + (size > 512 ? 512 : size) * 2);

while (size) {
size_t chunkSize = size;

if (chunkSize > 256) {
chunkSize = 256;
if (chunkSize > 512) {
chunkSize = 512;
}

command.reserve(19 + chunkSize * 2);
Expand Down Expand Up @@ -436,7 +436,7 @@ void NBClient::stop()
return;
}

MODEM.sendf("AT+USOCL=%d", _socket);
MODEM.sendf("AT+USOCL=%d,1", _socket);
MODEM.waitForResponse(10000);

NBSocketBuffer.close(_socket);
Expand All @@ -455,4 +455,4 @@ void NBClient::handleUrc(const String& urc)
}
}
}
}
}

0 comments on commit 00e8ae8

Please sign in to comment.