From 87eb5cbced0fc0c6646e0f9b4b78f649b9f84831 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Aug 2014 21:38:18 +0200 Subject: InputStream: move code to ExpensiveSeeking() --- src/input/InputStream.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/input') diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index 657b9df09..e73cf75e7 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -67,10 +67,22 @@ InputStream::LockWaitReady() WaitReady(); } +/** + * Is seeking on resources behind this URI "expensive"? For example, + * seeking in a HTTP file requires opening a new connection with a new + * HTTP request. + */ +gcc_pure +static bool +ExpensiveSeeking(const char *uri) +{ + return uri_has_scheme(uri); +} + bool InputStream::CheapSeeking() const { - return IsSeekable() && !uri_has_scheme(uri.c_str()); + return IsSeekable() && !ExpensiveSeeking(uri.c_str()); } bool -- cgit v1.2.3