Skip to content

Commit

Permalink
Bugfix: Opening a TCP connection when having a running BEARSSL connec…
Browse files Browse the repository at this point in the history
…tion leads to a conflict.

BearSSLClient is injected with tcpClients[0], but if a new TCP connection is requested than tcpClients[0] is assigned to the new connection which is of course a conflict with BearSSL which needs this very same WiFiClient instance.
  • Loading branch information
aentinger committed Apr 26, 2021
1 parent 6f82133 commit d407537
Showing 1 changed file with 2 additions and 2 deletions.
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 d407537

Please sign in to comment.