Skip to content

Commit

Permalink
WifiClient: Avoid repetitive map lookups in winsock variant,
Browse files Browse the repository at this point in the history
  • Loading branch information
nhjschulz committed Nov 20, 2024
1 parent 7aef35d commit 161a1e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/WiFiNative/src/WifiClientWinsock.inl
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@ size_t WiFiClient::write(const uint8_t* buffer, size_t size)

if ((0U < size) && (0U != connected()))
{
SOCKET socket = gSockets[this];

while ((0U < remaining) && (retries < SOCK_WRITE_RETRY))
{
int written = ::send(gSockets[this], reinterpret_cast<const char*>(buffer), remaining, 0);
int written = ::send(socket, reinterpret_cast<const char*>(buffer), remaining, 0);
if (SOCKET_ERROR == written)
{
int lastError = WSAGetLastError();
Expand Down Expand Up @@ -225,7 +227,7 @@ int WiFiClient::read(uint8_t* buffer, size_t size)
}
else if (1 == selectRet) /* read signaled */
{
ssize_t result = ::recv(gSockets[this], reinterpret_cast<char*>(buffer), size, 0);
ssize_t result = ::recv(socket, reinterpret_cast<char*>(buffer), size, 0);
if (-1 != result)
{
retval = result; /* Success! */
Expand Down

0 comments on commit 161a1e6

Please sign in to comment.