message: optimization sync client.
diff: @@ -668,14 +668,26 @@ static int swClient_tcp_sendfile_async(swClient *cli, char *filename, off_t offs
  return SW_OK;
  }
  +/**
  + * Only for synchronous client
  + */
  static int swClient_tcp_recv_no_buffer(swClient *cli, char *data, int len, int flag)
  {
  -#ifdef SW_USE_OPENSSL
  int ret, timeout_ms;
  +
  while (1)
  {
  ret = swConnection_recv(cli->socket, data, len, flag);
  - if (ret < 0 && errno == EAGAIN)
  + if (ret >= 0)
  + {
  + break;
  + }
  + if (errno == EINTR)
  + {
  + continue;
  + }
  +#ifdef SW_USE_OPENSSL
  + if (errno == EAGAIN && cli->socket->ssl)
  {
  timeout_ms = (int) (cli->timeout * 1000);
  if (cli->socket->ssl_want_read && swSocket_wait(cli->socket->fd, timeout_ms, SW_EVENT_READ) == SW_OK)
  @@ -686,24 +698,14 @@ static int swClient_tcp_recv_no_buffer(swClient *cli, char *data, int len, int f
  {
  continue;
  }
  - }
  + else
  + {
  break;
  }
  -#else
  - int ret = swConnection_recv(cli->socket, data, len, flag);
  #endif
  -
  - if (ret < 0)
  - {
  - if (errno == EINTR)
  - {
  - ret = swConnection_recv(cli->socket, data, len, flag);
  - }
  - else
  - {
  - return SW_ERR;
  }
  }
  +
  return ret;
  }
  