diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-07-03 10:55:37 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2006-07-03 10:55:37 +0000 |
commit | a040a7282a760eb3ee8dd627cf9280a0e8f72117 (patch) | |
tree | 4acdceaf6ee2901ae7c777104bb20785dfc940a5 /src/xine-engine/io_helper.c | |
parent | 8ffabdbc667bf05c313a295c34ac7a340b86a315 (diff) | |
download | xine-lib-a040a7282a760eb3ee8dd627cf9280a0e8f72117.tar.gz xine-lib-a040a7282a760eb3ee8dd627cf9280a0e8f72117.tar.bz2 |
Add a media.network.timeout configuration for a timeout while running select() on streams, to avoid getting frozen if trying to connect to an unreachable server (or if the connection is lost.
CVS patchset: 8087
CVS date: 2006/07/03 10:55:37
Diffstat (limited to 'src/xine-engine/io_helper.c')
-rw-r--r-- | src/xine-engine/io_helper.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index ae57b6938..8f1a5ad70 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -315,18 +315,24 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off off_t total = 0; int sret; int state = 0; + xine_cfg_entry_t cfgentry; + unsigned int timeout; if ((cmd == XIO_TCP_READ) || (cmd == XIO_FILE_READ)) { state = XIO_READ_READY; } else { state = XIO_WRITE_READY; } + + if (xine_config_lookup_entry (stream->xine, "media.network.timeout", &cfgentry)) { + timeout = entry.num_value * 1000; + } else { + timeout = 30000; /* 30K msecs = 30 secs */ + } while (total < todo) { - do { - sret = _x_io_select(stream, fd, state, 500); /* 500 ms */ - } while (sret == XIO_TIMEOUT); + sret = _x_io_select(stream, fd, state, timeout); if (sret != XIO_READY) return -1; |