Fr0sT-Brutal / Delphi_SChannelTLS

Helper functions and socket classes to perform TLS communication by means of WinAPI (SChannel)
MIT License
35 stars 16 forks source link

WSAEWOULDBLOCK support issue in SChannelSocketRequest #4

Open EricGrange opened 11 months ago

EricGrange commented 11 months ago

The code tests if res < 0 so the res = 0 will always fail, and WSAEWOULDBLOCK sleep never happens

      // get the data
      res := socket.Recv((PByte(IoBuffer) + cbData), cbIoBufferLength - cbData);
      if res < 0 then
      begin
        if (res = 0) and (WSAGetLastError = WSAEWOULDBLOCK) then
        begin
          Sleep(100);
          Continue;
        end;
        raise ESSPIError.CreateWinAPI('reading data from server', 'recv', res);
      end