Is it possible to limit the download rate?
IMHO, it was already implemented by TCP/IP stack.
And all that it is need to add is a small delay when the rate exceeds some
limit.
Something like that:

while(!EOF())
{
    get_piece_of_the_file();
    calc_the_rate();
    if (otp.max_rate && current_rate > otp.max_rate)
        sleep_for_a_while();
}

It will be very useful for modem users
and for loading a very large files from a very fast server.

Paul.

BTW,
mswindows.c::my_path() can be much more easy:

char *
ws_mypath (void)
{
  static char *wspathsave;
  char *buffer;
  char *ptr;

  if (wspathsave)
    {
      return wspathsave;
    }

  buffer = (char*) xmalloc (256);
  GetModuleFileName(NULL, buffer, 256);    // get the full path to
executable

  ptr = strrchr (buffer, '\\');
  if (ptr)
    {
      *(ptr + 1) = '\0';
      wspathsave = (char*) xmalloc (strlen(buffer)+1);
      strcpy (wspathsave, buffer);
    }
    else    // impossible case
    {
      wspathsave = (char*) xmalloc (2+1);
      strcpy (wspathsave, ".\\");
    }

  free (buffer);
  return wspathsave;
}


Reply via email to