CURLIO (and libcwd): add number of established connections to http console.

I need to parse the debug output of libcurl for this, and choose
to not do that for a Release build - at which point it makes little
sense to even do it for a Debug build, since also the Alpha release
are 'Release'. Even though it would probably have no impact on FPS,
there would be like two persons looking at that number and understanding
it.
This commit is contained in:
Aleric Inglewood
2013-07-03 23:54:07 +02:00
parent e0c66138c7
commit 4b0b83797c
6 changed files with 104 additions and 3 deletions

View File

@@ -1845,12 +1845,11 @@ CURLMcode MultiHandle::remove_easy_request(addedEasyRequests_type::iterator cons
{
AICurlEasyRequest_wat curl_easy_request_w(**iter);
bool downloaded_something = curl_easy_request_w->received_data();
bool success = curl_easy_request_w->success();
res = curl_easy_request_w->remove_handle_from_multi(curl_easy_request_w, mMultiHandle);
capability_type = curl_easy_request_w->capability_type();
per_service = curl_easy_request_w->getPerServicePtr();
CURLcode code;
curl_easy_request_w->getResult(&code, NULL);
PerService_wat(*per_service)->removed_from_multi_handle(capability_type, downloaded_something, code == CURLE_OK); // (About to be) removed from mAddedEasyRequests.
PerService_wat(*per_service)->removed_from_multi_handle(capability_type, downloaded_something, success); // (About to be) removed from mAddedEasyRequests.
#ifdef SHOW_ASSERT
curl_easy_request_w->mRemovedPerCommand = as_per_command;
#endif
@@ -2356,6 +2355,58 @@ int debug_callback(CURL* handle, curl_infotype infotype, char* buf, size_t size,
{
request->mDebugIsHeadOrGetMethod = true;
}
if (infotype == CURLINFO_TEXT)
{
if (!strncmp(buf, "STATE: WAITCONNECT => ", 22))
{
if (buf[22] == 'P' || buf[22] == 'D') // PROTOCONNECT or DO.
{
int n = size - 1;
while (buf[n] != ')')
{
llassert(n > 56);
--n;
}
int connectionnr = 0;
int factor = 1;
do
{
llassert(n > 56);
--n;
connectionnr += factor * (buf[n] - '0');
factor *= 10;
}
while(buf[n - 1] != '#');
// A new connection was established.
request->connection_established(connectionnr);
}
else
{
llassert(buf[22] == 'C'); // COMPLETED (connection failure).
}
}
else if (!strncmp(buf, "Closing connection", 18))
{
int n = size - 1;
while (!std::isdigit(buf[n]))
{
llassert(n > 20);
--n;
}
int connectionnr = 0;
int factor = 1;
do
{
llassert(n > 19);
connectionnr += factor * (buf[n] - '0');
factor *= 10;
--n;
}
while(buf[n] != '#');
// A connection was closed.
request->connection_closed(connectionnr);
}
}
#ifdef DEBUG_CURLIO
if (!debug_curl_print_debug(handle))