Replace TimeOut with Timeout everywhere.

This commit is contained in:
Aleric Inglewood
2012-10-15 21:01:16 +02:00
parent 76fc30e460
commit 02cffa9a71
4 changed files with 14 additions and 167 deletions

View File

@@ -850,7 +850,7 @@ class AICurlThread : public LLThread
curl_socket_t mWakeUpFd_in;
curl_socket_t mWakeUpFd;
int mZeroTimeOut;
int mZeroTimeout;
volatile bool mRunning;
};
@@ -862,7 +862,7 @@ AICurlThread* AICurlThread::sInstance = NULL;
AICurlThread::AICurlThread(void) : LLThread("AICurlThread"),
mWakeUpFd_in(CURL_SOCKET_BAD),
mWakeUpFd(CURL_SOCKET_BAD),
mZeroTimeOut(0), mRunning(true), mWakeUpFlag(false)
mZeroTimeout(0), mRunning(true), mWakeUpFlag(false)
{
create_wakeup_fds();
sInstance = this;
@@ -1304,27 +1304,27 @@ void AICurlThread::run(void)
// We're now entering select(), during which the main thread will write to the pipe/socket
// to wake us up, because it can't get the lock.
struct timeval timeout;
long timeout_ms = multi_handle_w->getTimeOut();
long timeout_ms = multi_handle_w->getTimeout();
// If no timeout is set, sleep 1 second.
if (LL_UNLIKELY(timeout_ms < 0))
timeout_ms = 1000;
if (LL_UNLIKELY(timeout_ms == 0))
{
if (mZeroTimeOut >= 10000)
if (mZeroTimeout >= 10000)
{
if (mZeroTimeOut == 10000)
if (mZeroTimeout == 10000)
llwarns << "Detected more than 10000 zero-timeout calls of select() by curl thread (more than 101 seconds)!" << llendl;
}
else if (mZeroTimeOut >= 1000)
else if (mZeroTimeout >= 1000)
timeout_ms = 10;
else if (mZeroTimeOut >= 100)
else if (mZeroTimeout >= 100)
timeout_ms = 1;
}
else
{
if (LL_UNLIKELY(mZeroTimeOut >= 10000))
if (LL_UNLIKELY(mZeroTimeout >= 10000))
llinfos << "Timeout of select() call by curl thread reset (to " << timeout_ms << " ms)." << llendl;
mZeroTimeOut = 0;
mZeroTimeout = 0;
}
timeout.tv_sec = timeout_ms / 1000;
timeout.tv_usec = (timeout_ms % 1000) * 1000;
@@ -1497,7 +1497,7 @@ int MultiHandle::timer_callback(CURLM* multi, long timeout_ms, void* userp)
{
MultiHandle& self = *static_cast<MultiHandle*>(userp);
llassert(multi == self.mMultiHandle);
self.mTimeOut = timeout_ms;
self.mTimeout = timeout_ms;
Dout(dc::curl, "MultiHandle::timer_callback(): timeout set to " << timeout_ms << " ms.");
return 0;
}

View File

@@ -79,7 +79,7 @@ class MultiHandle : public CurlMultiHandle
bool mHandleAddedOrRemoved; // Set when an easy handle was added or removed, reset in check_run_count().
int mPrevRunningHandles; // The last value of mRunningHandles that check_run_count() was called with.
int mRunningHandles; // The last value returned by curl_multi_socket_action.
long mTimeOut; // The last time out in ms as set by the callback CURLMOPT_TIMERFUNCTION.
long mTimeout; // The last timeout in ms as set by the callback CURLMOPT_TIMERFUNCTION.
private:
// Store result and trigger events for easy request.
@@ -96,7 +96,7 @@ class MultiHandle : public CurlMultiHandle
int getRunningHandles(void) const { return mRunningHandles; }
// Returns how long to wait for socket action before calling socket_action(CURL_SOCKET_TIMEOUT, 0), in ms.
int getTimeOut(void) const { return mTimeOut; }
int getTimeout(void) const { return mTimeout; }
// This is called before sleeping, after calling (one or more times) socket_action.
void check_run_count(void);