HTTP timeout work in progress.
More debug output. Avoid the new assert when exiting the viewer.
This commit is contained in:
@@ -1338,6 +1338,7 @@ void CurlEasyRequest::timeout_add_easy_request(void)
|
||||
// This boolean is valid (only) if we get a time out event from libcurl.
|
||||
mTimeoutNothingReceivedYet = true;
|
||||
mTimeoutStalled = (U64)-1;
|
||||
DoutCurlEasy("timeout_add_easy_request: mTimeoutStalled set to -1");
|
||||
}
|
||||
|
||||
// CURL-THREAD
|
||||
@@ -1370,6 +1371,7 @@ void CurlEasyRequest::timeout_reset_lowspeed(void)
|
||||
mTimeoutLowSpeedOn = true;
|
||||
mTimeoutLastSecond = -1; // This causes timeout_lowspeed to initialize the rest.
|
||||
mTimeoutStalled = (U64)-1; // Stop reply delay timer.
|
||||
DoutCurlEasy("timeout_reset_lowspeed: mTimeoutStalled set to -1");
|
||||
}
|
||||
|
||||
// CURL-THREAD
|
||||
@@ -1384,6 +1386,7 @@ void CurlEasyRequest::timeout_upload_finished(void)
|
||||
mTimeoutLowSpeedOn = false;
|
||||
// Timeout if the server doesn't reply quick enough.
|
||||
mTimeoutStalled = sTimeoutClockCount + mTimeoutPolicy->getReplyDelay() / sTimeoutClockWidth;
|
||||
DoutCurlEasy("timeout_upload_finished: mTimeoutStalled set to sTimeoutClockCount (" << sTimeoutClockCount << ") + " << (mTimeoutStalled - sTimeoutClockCount) << " (" << mTimeoutPolicy->getReplyDelay() << " seconds)");
|
||||
}
|
||||
|
||||
// CURL-THREAD
|
||||
@@ -1519,6 +1522,7 @@ bool CurlEasyRequest::timeout_lowspeed(size_t bytes)
|
||||
}
|
||||
// If this function isn't called until mTimeoutStalled, we stalled.
|
||||
mTimeoutStalled = sTimeoutClockCount + max_stall_time / sTimeoutClockWidth;
|
||||
DoutCurlEasy("mTimeoutStalled set to sTimeoutClockCount (" << sTimeoutClockCount << ") + " << (mTimeoutStalled - sTimeoutClockCount) << " (" << max_stall_time << " seconds)");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1543,6 +1547,7 @@ void CurlEasyRequest::timeout_done(CURLcode code)
|
||||
// Make sure no timeout will happen anymore.
|
||||
mTimeoutLowSpeedOn = false;
|
||||
mTimeoutStalled = (U64)-1;
|
||||
DoutCurlEasy("timeout_done: mTimeoutStalled set to -1");
|
||||
}
|
||||
|
||||
// End of HTTP Timeout stuff.
|
||||
|
||||
@@ -695,6 +695,23 @@ bool MergeIterator::next(curl_socket_t& fd_out, int& ev_bitmask_out)
|
||||
//-----------------------------------------------------------------------------
|
||||
// CurlSocketInfo
|
||||
|
||||
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
|
||||
#undef AI_CASE_RETURN
|
||||
#define AI_CASE_RETURN(x) do { case x: return #x; } while(0)
|
||||
static char const* action_str(int action)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
AI_CASE_RETURN(CURL_POLL_NONE);
|
||||
AI_CASE_RETURN(CURL_POLL_IN);
|
||||
AI_CASE_RETURN(CURL_POLL_OUT);
|
||||
AI_CASE_RETURN(CURL_POLL_INOUT);
|
||||
AI_CASE_RETURN(CURL_POLL_REMOVE);
|
||||
}
|
||||
return "<unknown action>";
|
||||
}
|
||||
#endif
|
||||
|
||||
// A class with info for each socket that is in use by curl.
|
||||
class CurlSocketInfo
|
||||
{
|
||||
@@ -729,6 +746,7 @@ CurlSocketInfo::~CurlSocketInfo()
|
||||
|
||||
void CurlSocketInfo::set_action(int action)
|
||||
{
|
||||
Dout(dc::curl, "CurlSocketInfo::set_action(" << action_str(mAction) << " --> " << action_str(action) << ") [" << (void*)mEasyRequest.get_ptr().get() << "]");
|
||||
int toggle_action = mAction ^ action;
|
||||
mAction = action;
|
||||
if ((toggle_action & CURL_POLL_IN))
|
||||
@@ -1366,6 +1384,7 @@ MultiHandle::~MultiHandle()
|
||||
// Curl demands that all handles are removed from the multi session handle before calling curl_multi_cleanup.
|
||||
for(addedEasyRequests_type::iterator iter = mAddedEasyRequests.begin(); iter != mAddedEasyRequests.end(); iter = mAddedEasyRequests.begin())
|
||||
{
|
||||
finish_easy_request(*iter, CURLE_OK); // Error code is not used anyway.
|
||||
remove_easy_request(*iter);
|
||||
}
|
||||
delete mWritePollSet;
|
||||
@@ -1387,23 +1406,6 @@ void MultiHandle::handle_stalls(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CWDEBUG) || defined(DEBUG_CURLIO)
|
||||
#undef AI_CASE_RETURN
|
||||
#define AI_CASE_RETURN(x) do { case x: return #x; } while(0)
|
||||
char const* action_str(int action)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
AI_CASE_RETURN(CURL_POLL_NONE);
|
||||
AI_CASE_RETURN(CURL_POLL_IN);
|
||||
AI_CASE_RETURN(CURL_POLL_OUT);
|
||||
AI_CASE_RETURN(CURL_POLL_INOUT);
|
||||
AI_CASE_RETURN(CURL_POLL_REMOVE);
|
||||
}
|
||||
return "<unknown action>";
|
||||
}
|
||||
#endif
|
||||
|
||||
//static
|
||||
int MultiHandle::socket_callback(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user