Skip to content

Commit

Permalink
Merge pull request #66 from arduino/fix-reconnection-errors
Browse files Browse the repository at this point in the history
Fix firmware reconnection errors
  • Loading branch information
aentinger authored Apr 27, 2021
2 parents 4430423 + d407537 commit ac95d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions arduino/libraries/WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int WiFiClient::peek()
{
uint8_t b;

if (recv(_socket, &b, sizeof(b), MSG_PEEK | MSG_DONTWAIT) <= 0) {
if (lwip_recv_r(_socket, &b, sizeof(b), MSG_PEEK | MSG_DONTWAIT) <= 0) {
if (errno != EWOULDBLOCK) {
lwip_close_r(_socket);
_socket = -1;
Expand All @@ -177,7 +177,7 @@ void WiFiClient::stop()
uint8_t WiFiClient::connected()
{
if (_socket != -1) {
available();
peek();
}

return (_socket != -1);
Expand Down
4 changes: 2 additions & 2 deletions main/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ WiFiUDP udps[MAX_SOCKETS];
WiFiSSLClient tlsClients[MAX_SOCKETS];
WiFiServer tcpServers[MAX_SOCKETS];

BearSSLClient bearsslClient(tcpClients[0], ArduinoIoTCloudTrustAnchor, ArduinoIoTCloudTrustAnchor_NUM);
WiFiClient bearssl_tcp_client;
BearSSLClient bearsslClient(bearssl_tcp_client, ArduinoIoTCloudTrustAnchor, ArduinoIoTCloudTrustAnchor_NUM);

int setNet(const uint8_t command[], uint8_t response[])
{
Expand Down Expand Up @@ -664,7 +665,6 @@ int startClientTcp(const uint8_t command[], uint8_t response[])
} else if (type == 0x04) {
int result;

bearsslClient.setClient(tcpClients[socket]);
configureECCx08();

if (host[0] != '\0') {
Expand Down

0 comments on commit ac95d6a

Please sign in to comment.