Final compile/link bug fixes for debug_libcurl code.
renamed cwdebug/debug_libcurl.cc -> llmessage/debug_libcurl.cpp
and cwdebug/debug_libcurl.h -> llmessage/debug_libcurl.h,
because debug_libcurl.cpp does curl calls that do ares and
openssl calls, so we need to link with those libraries.
llmessage is already linking with those libraries, and contains
the main entry point aicurl.h, so it's a suitable place to put
this.
Bug fix: must always include llpreprocessor.h before including
curl/curl.h.
Bug fix: Added #include "debug_libcurl.h" to hipporestrequest.cpp
and llurlsimstring.cpp which I missed before because they
included "curl/curl.h" instead of <curl/curl.h>. Same in
llwaterparammanager.cpp, but removed include there because it
isn't needed.
Now test DEBUG_CURLIO before including debug_curlio, that
seems better, because otherwise it would make more sense to
replace all #include <curl/curl.h> with #include "mycurl.h"
and then do it there-- but I didn't want to do that.
Bug fix: we undef-ed CURLOPT_DNS_USE_GLOBAL_CACHE, while really
that is an enum, not a macro.
Fixed DEBUG_WINDOWS_CODE_ON_LINUX again by adding a hack for
ioctlsocket(), not instantiating dumb_socketpair unless
DEBUG_WINDOWS_CODE_ON_LINUX is defined and removing again ^M's
introduced with the new windows non-blocking code.
Also changed the type of flags passed to fcntl to int (was long).
This commit is contained in:
@@ -2,7 +2,6 @@ include_directories (${CMAKE_SOURCE_DIR}/cwdebug)
|
||||
|
||||
set(cwdebug_SOURCE_FILES
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/debug.cc
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/debug_libcurl.cc
|
||||
)
|
||||
|
||||
set(cwdebug_HEADER_FILES
|
||||
@@ -10,7 +9,6 @@ set(cwdebug_HEADER_FILES
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/sys.h
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/debug.h
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/debug_ostream_operators.h
|
||||
${CMAKE_SOURCE_DIR}/cwdebug/debug_libcurl.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${cwdebug_HEADER_FILES}
|
||||
|
||||
@@ -30,6 +30,7 @@ set(llmessage_SOURCE_FILES
|
||||
llcircuit.cpp
|
||||
llclassifiedflags.cpp
|
||||
aicurl.cpp
|
||||
debug_libcurl.cpp
|
||||
aicurlthread.cpp
|
||||
lldatapacker.cpp
|
||||
lldispatcher.cpp
|
||||
@@ -117,6 +118,7 @@ set(llmessage_HEADER_FILES
|
||||
llclassifiedflags.h
|
||||
llcurl.h
|
||||
aicurl.h
|
||||
debug_libcurl.h
|
||||
aicurlprivate.h
|
||||
aicurlthread.h
|
||||
lldatapacker.h
|
||||
|
||||
@@ -37,11 +37,16 @@
|
||||
#include <stdexcept>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include "llpreprocessor.h"
|
||||
#include <curl/curl.h> // Needed for files that include this header (also for aicurlprivate.h).
|
||||
#ifdef DEBUG_CURLIO
|
||||
#include "debug_libcurl.h"
|
||||
#endif
|
||||
|
||||
// Make sure we don't use this option: it is not thread-safe.
|
||||
#undef CURLOPT_DNS_USE_GLOBAL_CACHE
|
||||
#define CURLOPT_DNS_USE_GLOBAL_CACHE do_not_use_CURLOPT_DNS_USE_GLOBAL_CACHE
|
||||
|
||||
#include "stdtypes.h" // U32
|
||||
#include "lliopipe.h" // LLIOPipe::buffer_ptr_t
|
||||
|
||||
@@ -177,6 +177,19 @@ int closesocket(curl_socket_t fd)
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
int const FIONBIO = 0;
|
||||
|
||||
int ioctlsocket(int fd, int, unsigned long* nonblocking_enable)
|
||||
{
|
||||
int res = fcntl(fd, F_GETFL, 0);
|
||||
llassert_always(res != -1);
|
||||
if (*nonblocking_enable)
|
||||
res |= O_NONBLOCK;
|
||||
else
|
||||
res &= ~O_NONBLOCK;
|
||||
return fcntl(fd, F_SETFD, res);
|
||||
}
|
||||
|
||||
#endif // DEBUG_WINDOWS_CODE_ON_LINUX
|
||||
|
||||
#define WINDOWS_CODE (LL_WINDOWS || DEBUG_WINDOWS_CODE_ON_LINUX)
|
||||
@@ -894,7 +907,7 @@ static int dumb_socketpair(SOCKET socks[2], bool make_overlapped)
|
||||
WSASetLastError(e);
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
#else
|
||||
#elif WINDOWS_CODE
|
||||
int dumb_socketpair(int socks[2], int dummy)
|
||||
{
|
||||
(void) dummy;
|
||||
@@ -913,18 +926,18 @@ void AICurlThread::create_wakeup_fds(void)
|
||||
llerrs << "Failed to generate wake-up socket pair" << formatWSAError() << llendl;
|
||||
return;
|
||||
}
|
||||
u_long nonblocking_enable = TRUE;
|
||||
int error = ioctlsocket(socks[0], FIONBIO, &nonblocking_enable);
|
||||
if(error)
|
||||
{
|
||||
llerrs << "Failed to set wake-up socket nonblocking: " << formatWSAError() << llendl;
|
||||
}
|
||||
llassert(nonblocking_enable);
|
||||
error = ioctlsocket(socks[1], FIONBIO, &nonblocking_enable);
|
||||
if(error)
|
||||
{
|
||||
llerrs << "Failed to set wake-up input socket nonblocking: " << formatWSAError() << llendl;
|
||||
}
|
||||
u_long nonblocking_enable = TRUE;
|
||||
int error = ioctlsocket(socks[0], FIONBIO, &nonblocking_enable);
|
||||
if(error)
|
||||
{
|
||||
llerrs << "Failed to set wake-up socket nonblocking: " << formatWSAError() << llendl;
|
||||
}
|
||||
llassert(nonblocking_enable);
|
||||
error = ioctlsocket(socks[1], FIONBIO, &nonblocking_enable);
|
||||
if(error)
|
||||
{
|
||||
llerrs << "Failed to set wake-up input socket nonblocking: " << formatWSAError() << llendl;
|
||||
}
|
||||
mWakeUpFd = socks[0];
|
||||
mWakeUpFd_in = socks[1];
|
||||
#else
|
||||
@@ -933,7 +946,7 @@ void AICurlThread::create_wakeup_fds(void)
|
||||
{
|
||||
llerrs << "Failed to create wakeup pipe: " << strerror(errno) << llendl;
|
||||
}
|
||||
long flags = O_NONBLOCK;
|
||||
int const flags = O_NONBLOCK;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (fcntl(pipefd[i], F_SETFL, flags))
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <stdarg.h>
|
||||
#include "llpreprocessor.h"
|
||||
#include <curl/curl.h>
|
||||
#define COMPILING_DEBUG_LIBCURL_CC
|
||||
#include "debug_libcurl.h"
|
||||
#include "../llcommon/llerror.h"
|
||||
@@ -801,6 +803,7 @@ char* debug_curl_version(void)
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
#else // DEBUG_CURLIO
|
||||
int debug_libcurl_dummy; // I thought some OS didn't like empty source files.
|
||||
#endif
|
||||
#endif // DEBUG_CURLIO
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
#ifndef DEBUG_LIBCURL
|
||||
#define DEBUG_LIBCURL
|
||||
|
||||
#ifdef DEBUG_CURLIO
|
||||
#ifndef DEBUG_CURLIO
|
||||
#error "Don't include debug_libcurl.h unless DEBUG_CURLIO is defined."
|
||||
#endif
|
||||
|
||||
#ifndef CURLINFO_TYPEMASK
|
||||
#error "<curl/curl.h> must be included before including debug_libcurl.h!"
|
||||
#endif
|
||||
|
||||
#ifndef LLPREPROCESSOR_H
|
||||
// CURL_STATICLIB is needed on windows namely, which is defined in llpreprocessor.h (but only on windows).
|
||||
#error "llpreprocessor.h must be included before <curl/curl.h>."
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include "debug.h"
|
||||
|
||||
extern "C" {
|
||||
@@ -78,6 +88,4 @@ extern CWD_API char* debug_curl_version(void);
|
||||
|
||||
#endif // !COMPILING_DEBUG_LIBCURL_CC
|
||||
|
||||
#endif // DEBUG_CURLIO
|
||||
|
||||
#endif // DEBUG_LIBCURL
|
||||
@@ -8,14 +8,16 @@
|
||||
#endif
|
||||
|
||||
#include <stdtypes.h>
|
||||
#include <llbufferstream.h>
|
||||
#include <llerror.h>
|
||||
#include <llhttpclient.h>
|
||||
#include <llurlrequest.h>
|
||||
#include <llxmltree.h>
|
||||
#include "llbufferstream.h"
|
||||
#include "llerror.h"
|
||||
#include "llhttpclient.h"
|
||||
#include "llurlrequest.h"
|
||||
#include "llxmltree.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
#ifdef DEBUG_CURLIO
|
||||
#include "debug_libcurl.h"
|
||||
#endif
|
||||
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@
|
||||
#include "llpanellogin.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
#include "curl/curl.h"
|
||||
#include <curl/curl.h> // curl_unescape, curl_free
|
||||
#ifdef DEBUG_CURLIO
|
||||
#include "debug_libcurl.h"
|
||||
#endif
|
||||
|
||||
//static
|
||||
LLURLSimString LLURLSimString::sInstance;
|
||||
|
||||
@@ -76,8 +76,6 @@
|
||||
|
||||
#include "llagentcamera.h"
|
||||
|
||||
#include "curl/curl.h"
|
||||
|
||||
LLWaterParamManager::LLWaterParamManager() :
|
||||
mFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f, 0.0f, "waterFogColor", "WaterFogColor"),
|
||||
mFogDensity(4, "waterFogDensity", 2),
|
||||
|
||||
Reference in New Issue
Block a user