fix read write pb

This commit is contained in:
lxsang 2018-10-27 16:21:12 +02:00
parent 64554bd2f5
commit 303a2391f6

View File

@ -319,12 +319,12 @@ int antd_recv(void *src, void* data, int len)
while (readlen > 0 )//&& source->attempt < MAX_ATTEMPT while (readlen > 0 )//&& source->attempt < MAX_ATTEMPT
{ {
received = recv(((int) source->sock), ptr+read, readlen, 0); received = recv(((int) source->sock), ptr+read, readlen, 0);
LOG("Read : %c\n", *ptr); //LOG("Read : %c\n", *ptr);
if (received > 0) if (received > 0)
{ {
read += received; read += received;
readlen = (len - read) > BUFFLEN?BUFFLEN:(len-read); readlen = (len - read) > BUFFLEN?BUFFLEN:(len-read);
LOG("Read len is %d\n", readlen); //LOG("Read len is %d\n", readlen);
} }
else if(errno != EAGAIN && errno != EWOULDBLOCK) else if(errno != EAGAIN && errno != EWOULDBLOCK)
{ {