Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/tcpip/fnTcpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ class fnTcpClientSocketHandle

fnTcpClient::fnTcpClient(int fd)
{
_fd = fd;
_connected = true;
_clientSocketHandle.reset(new fnTcpClientSocketHandle(_fd));
_clientSocketHandle.reset(new fnTcpClientSocketHandle(fd));
_rxBuffer.clear();
}

Expand Down Expand Up @@ -432,23 +431,24 @@ void fnTcpClient::updateFIFO()

#if defined(_WIN32)
unsigned long count;
int res = ioctlsocket(_fd, FIONREAD, &count);
int res = ioctlsocket(fd(), FIONREAD, &count);
res = res != 0 ? -1 : count;
#else
int count;
int res = ioctl(_fd, FIONREAD, &count);
int res = ioctl(fd(), FIONREAD, &count);
res = res < 0 ? -1 : count;
#endif

if (res > 0)
{
ssize_t result;
unsigned count;

for (count = res; count; count -= result)
{
size_t old_len = _rxBuffer.size();
_rxBuffer.resize(old_len + count);
result = recv(_fd, &_rxBuffer[old_len], count, 0);
result = recv(fd(), &_rxBuffer[old_len], count, 0);
if (result < 0)
result = 0;
_rxBuffer.resize(old_len + result);
Expand Down Expand Up @@ -484,7 +484,7 @@ void fnTcpClient::flush()
res = recv(fd(), (char *)buf, toRead, MSG_DONTWAIT);
if (res < 0)
{
Debug_printf("fail on fd %d, errno: %d, \"%s\"\r\n",
Debug_printf("fail on fd %d, errno: %d, \"%s\"\r\n",
fd(), compat_getsockerr(), compat_sockstrerror(compat_getsockerr()));
stop();
break;
Expand Down
1 change: 0 additions & 1 deletion lib/tcpip/fnTcpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class fnTcpClient
{
protected:
std::string _rxBuffer;
int _fd;
std::shared_ptr<fnTcpClientSocketHandle> _clientSocketHandle;
bool _connected = false;

Expand Down
Loading