Hi all,

I would like xine_open() to return within, say, 4 seconds when trying to open a http URL. I have set media.network.timeout to 4.

This timeout is not honored when the network cable is unplugged. It takes around 80 secs for xine_open() to return.

Looking into input_http.c, I find the delay is during the call to _x_io_tcp_connect(). And the timeout set via media.network.timeout is active not untill this function returns, as you see below.

Could someone provide a fix for this (set _x_io_tcp_connect to timeout) ? Or have I misunderstood the purpose of media.network.timeout config variable ?

Thanks.

http_input.c : static int http_plugin_open (input_plugin_t *this_gen )
------

  if (use_proxy)
    this->fh = _x_io_tcp_connect (this->stream, this_class->proxyhost, proxyport);
  else
    this->fh = _x_io_tcp_connect (this->stream, this->host, this->port);         /*TAKES TOO LONG*/

  this->curpos = 0;

  if (this->fh == -1)
    return -2;

  {
    uint32_t         timeout, progress;
    xine_cfg_entry_t cfgentry;
    if (xine_config_lookup_entry (this->stream->xine, "media.network.timeout", &cfgentry)) {
      timeout = cfgentry.num_value * 1000;
    } else {
      timeout = 30000; /* 30K msecs = 30 secs */
    }

    progress = 0;
    int count_tmp = 0;
    do {
      report_progress(this->stream, progress);
      res = _x_io_select (this->stream, this->fh, XIO_WRITE_READY, 500);
      progress += (500*100000)/timeout;
      ++count_tmp;
    } while ((res == XIO_TIMEOUT) && (progress <= 100000));

    if (res != XIO_READY) {
      _x_message(this->stream, XINE_MSG_NETWORK_UNREACHABLE, this->mrl, NULL);
      return -3;
    }


--

Sundararaj