Merge remote-tracking branch 'lirusaito/curlthreading2' into curlthreading2
This commit is contained in:
@@ -229,7 +229,7 @@ void ssl_init(void)
|
|||||||
SSLeay_version(SSLEAY_VERSION) << " (0x" << std::hex << SSLeay() << ")." << llendl;
|
SSLeay_version(SSLEAY_VERSION) << " (0x" << std::hex << SSLeay() << ")." << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup OpenSLL library thread-safety.
|
// Cleanup OpenSSL library thread-safety.
|
||||||
void ssl_cleanup(void)
|
void ssl_cleanup(void)
|
||||||
{
|
{
|
||||||
// Dynamic locks callbacks.
|
// Dynamic locks callbacks.
|
||||||
@@ -895,7 +895,7 @@ void CurlEasyRequest::applyDefaultOptions(void)
|
|||||||
setoptString(CURLOPT_CAINFO, CertificateAuthority_r->file);
|
setoptString(CURLOPT_CAINFO, CertificateAuthority_r->file);
|
||||||
// This option forces openssl to use TLS version 1.
|
// This option forces openssl to use TLS version 1.
|
||||||
// The Linden Lab servers don't support later TLS versions, and libopenssl-1.0.1c has
|
// The Linden Lab servers don't support later TLS versions, and libopenssl-1.0.1c has
|
||||||
// a bug were renegotion fails (see http://rt.openssl.org/Ticket/Display.html?id=2828),
|
// a bug where renegotiation fails (see http://rt.openssl.org/Ticket/Display.html?id=2828),
|
||||||
// causing the connection to fail completely without this hack.
|
// causing the connection to fail completely without this hack.
|
||||||
// For a commandline test of the same, observe the difference between:
|
// For a commandline test of the same, observe the difference between:
|
||||||
// openssl s_client -connect login.agni.lindenlab.com:443 -CAfile packaged/app_settings/CA.pem -debug
|
// openssl s_client -connect login.agni.lindenlab.com:443 -CAfile packaged/app_settings/CA.pem -debug
|
||||||
@@ -905,12 +905,12 @@ void CurlEasyRequest::applyDefaultOptions(void)
|
|||||||
setopt(CURLOPT_NOSIGNAL, 1);
|
setopt(CURLOPT_NOSIGNAL, 1);
|
||||||
// The old code did this for the 'buffered' version, but I think it's nonsense.
|
// The old code did this for the 'buffered' version, but I think it's nonsense.
|
||||||
//setopt(CURLOPT_DNS_CACHE_TIMEOUT, 0);
|
//setopt(CURLOPT_DNS_CACHE_TIMEOUT, 0);
|
||||||
// Set the CURL options for either Socks or HTTP proxy.
|
// Set the CURL options for either SOCKS or HTTP proxy.
|
||||||
applyProxySettings();
|
applyProxySettings();
|
||||||
Debug(
|
Debug(
|
||||||
if (dc::curl.is_on())
|
if (dc::curl.is_on())
|
||||||
{
|
{
|
||||||
setopt(CURLOPT_VERBOSE, 1); // Usefull for debugging.
|
setopt(CURLOPT_VERBOSE, 1); // Useful for debugging.
|
||||||
setopt(CURLOPT_DEBUGFUNCTION, &curl_debug_callback);
|
setopt(CURLOPT_DEBUGFUNCTION, &curl_debug_callback);
|
||||||
setopt(CURLOPT_DEBUGDATA, this);
|
setopt(CURLOPT_DEBUGDATA, this);
|
||||||
}
|
}
|
||||||
@@ -925,11 +925,11 @@ void CurlEasyRequest::finalizeRequest(std::string const& url)
|
|||||||
lldebugs << url << llendl;
|
lldebugs << url << llendl;
|
||||||
setopt(CURLOPT_HTTPHEADER, mHeaders);
|
setopt(CURLOPT_HTTPHEADER, mHeaders);
|
||||||
setoptString(CURLOPT_URL, url);
|
setoptString(CURLOPT_URL, url);
|
||||||
// The following line is a bit tricky: we store a pointer to the object without increasing it's reference count.
|
// The following line is a bit tricky: we store a pointer to the object without increasing its reference count.
|
||||||
// Of course we could increment the reference count, but that doesn't help much: if then this pointer would
|
// Of course we could increment the reference count, but that doesn't help much: if then this pointer would
|
||||||
// get "lost" we'd have a memory leak. Either way we must make sure that it is impossible that this pointer
|
// get "lost" we'd have a memory leak. Either way we must make sure that it is impossible that this pointer
|
||||||
// will be used if the object is deleted [In fact, since this is finalizeRequest() and not addRequest(),
|
// will be used if the object is deleted [In fact, since this is finalizeRequest() and not addRequest(),
|
||||||
// incrementing the reference counter would be wrong: if addRequest is never called then the object is
|
// incrementing the reference counter would be wrong: if addRequest() is never called then the object is
|
||||||
// destroyed shortly after and this pointer is never even used.]
|
// destroyed shortly after and this pointer is never even used.]
|
||||||
// This pointer is used in MultiHandle::check_run_count, which means that addRequest() was called and
|
// This pointer is used in MultiHandle::check_run_count, which means that addRequest() was called and
|
||||||
// the reference counter was increased and the object is being kept alive, see the comments above
|
// the reference counter was increased and the object is being kept alive, see the comments above
|
||||||
@@ -1004,7 +1004,7 @@ CurlResponderBuffer::CurlResponderBuffer()
|
|||||||
CurlResponderBuffer::~CurlResponderBuffer()
|
CurlResponderBuffer::~CurlResponderBuffer()
|
||||||
{
|
{
|
||||||
ThreadSafeBufferedCurlEasyRequest* lockobj = get_lockobj();
|
ThreadSafeBufferedCurlEasyRequest* lockobj = get_lockobj();
|
||||||
AICurlEasyRequest_wat curl_easy_request_w(*lockobj); // Wait till possible callbacks have returned.
|
AICurlEasyRequest_wat curl_easy_request_w(*lockobj); // Wait 'til possible callbacks have returned.
|
||||||
curl_easy_request_w->send_events_to(NULL);
|
curl_easy_request_w->send_events_to(NULL);
|
||||||
curl_easy_request_w->revokeCallbacks();
|
curl_easy_request_w->revokeCallbacks();
|
||||||
if (mResponder)
|
if (mResponder)
|
||||||
@@ -1093,7 +1093,7 @@ size_t CurlResponderBuffer::curlWriteCallback(char* data, size_t size, size_t nm
|
|||||||
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
||||||
|
|
||||||
// We need to lock the curl easy request object too, because that lock is used
|
// We need to lock the curl easy request object too, because that lock is used
|
||||||
// to make sure that callbacks and destruction aren't done simulaneously.
|
// to make sure that callbacks and destruction aren't done simultaneously.
|
||||||
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
||||||
|
|
||||||
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
||||||
@@ -1108,7 +1108,7 @@ size_t CurlResponderBuffer::curlReadCallback(char* data, size_t size, size_t nme
|
|||||||
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
||||||
|
|
||||||
// We need to lock the curl easy request object too, because that lock is used
|
// We need to lock the curl easy request object too, because that lock is used
|
||||||
// to make sure that callbacks and destruction aren't done simulaneously.
|
// to make sure that callbacks and destruction aren't done simultaneously.
|
||||||
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
||||||
|
|
||||||
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
||||||
@@ -1129,7 +1129,7 @@ size_t CurlResponderBuffer::curlHeaderCallback(char* data, size_t size, size_t n
|
|||||||
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast<ThreadSafeBufferedCurlEasyRequest*>(user_data);
|
||||||
|
|
||||||
// We need to lock the curl easy request object too, because that lock is used
|
// We need to lock the curl easy request object too, because that lock is used
|
||||||
// to make sure that callbacks and destruction aren't done simulaneously.
|
// to make sure that callbacks and destruction aren't done simultaneously.
|
||||||
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
AICurlEasyRequest_wat buffered_easy_request_w(*lockobj);
|
||||||
|
|
||||||
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
AICurlResponderBuffer_wat buffer_w(*lockobj);
|
||||||
|
|||||||
@@ -125,19 +125,19 @@ void setCAPath(std::string const& file);
|
|||||||
// The life cycle of classes derived from this class is as follows:
|
// The life cycle of classes derived from this class is as follows:
|
||||||
// They are allocated with new on the line where get(), getByteRange() or post() is called,
|
// They are allocated with new on the line where get(), getByteRange() or post() is called,
|
||||||
// and the pointer to the allocated object is then put in a reference counting ResponderPtr.
|
// and the pointer to the allocated object is then put in a reference counting ResponderPtr.
|
||||||
// This ResponderPtr is passed to CurlResponderBuffer::prepRequest which stores it in it's
|
// This ResponderPtr is passed to CurlResponderBuffer::prepRequest which stores it in its
|
||||||
// member mResponder. Hence, the life time of a Responder is never longer than it's
|
// member mResponder. Hence, the life time of a Responder is never longer than its
|
||||||
// associated CurlResponderBuffer, however, if everything works correct, then normally a
|
// associated CurlResponderBuffer, however, if everything works correctly, then normally a
|
||||||
// responder is deleted in CurlResponderBuffer::removed_from_multi_handle by setting
|
// responder is deleted in CurlResponderBuffer::removed_from_multi_handle by setting
|
||||||
// mReponder to NULL.
|
// mReponder to NULL.
|
||||||
//
|
//
|
||||||
// Note that the life time of CurlResponderBuffer is (a bit) shorter than the associated
|
// Note that the lifetime of CurlResponderBuffer is (a bit) shorter than the associated
|
||||||
// CurlEasyRequest (because of the order of base classes of ThreadSafeBufferedCurlEasyRequest)
|
// CurlEasyRequest (because of the order of base classes of ThreadSafeBufferedCurlEasyRequest)
|
||||||
// and the callbacks, as set by prepRequest, only use those two.
|
// and the callbacks, as set by prepRequest, only use those two.
|
||||||
// A callback locks the CurlEasyRequest before actually making the callback, and the
|
// A callback locks the CurlEasyRequest before actually making the callback, and the
|
||||||
// destruction of CurlResponderBuffer also first locks the CurlEasyRequest, and then revokes
|
// destruction of CurlResponderBuffer also first locks the CurlEasyRequest, and then revokes
|
||||||
// the callbacks. This assures that a Responder is never used when the objects it uses are
|
// the callbacks. This assures that a Responder is never used when the objects it uses are
|
||||||
// destructed. Also, if any of those are destructed then the responder is automatically
|
// destructed. Also, if any of those are destructed then the Responder is automatically
|
||||||
// destructed too.
|
// destructed too.
|
||||||
//
|
//
|
||||||
class Responder {
|
class Responder {
|
||||||
@@ -150,8 +150,8 @@ class Responder {
|
|||||||
std::string mURL;
|
std::string mURL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called to set the url of the current request for this responder,
|
// Called to set the URL of the current request for this Responder,
|
||||||
// used only when printing debug output regarding activity of the responder.
|
// used only when printing debug output regarding activity of the Responder.
|
||||||
void setURL(std::string const& url);
|
void setURL(std::string const& url);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -193,7 +193,7 @@ class Responder {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Called from LLSDMessage::ResponderAdapter::listener.
|
// Called from LLSDMessage::ResponderAdapter::listener.
|
||||||
// LLSDMessage::ResponderAdapter is a hack, showing among others by fact that these function needs to be public.
|
// LLSDMessage::ResponderAdapter is a hack, showing among others by fact that these functions need to be public.
|
||||||
|
|
||||||
void pubErrorWithContent(U32 status, std::string const& reason, LLSD const& content) { errorWithContent(status, reason, content); }
|
void pubErrorWithContent(U32 status, std::string const& reason, LLSD const& content) { errorWithContent(status, reason, content); }
|
||||||
void pubResult(LLSD const& content) { result(content); }
|
void pubResult(LLSD const& content) { result(content); }
|
||||||
@@ -246,12 +246,12 @@ struct AICurlEasyHandleEvents {
|
|||||||
// Therefore we use the following trick: we wrap CurlEasyRequestPtr too, and only allow
|
// Therefore we use the following trick: we wrap CurlEasyRequestPtr too, and only allow
|
||||||
// read accesses on it.
|
// read accesses on it.
|
||||||
|
|
||||||
// AICurlEasyRequest: a thread safe, reference counting, auto cleaning curl easy handle.
|
// AICurlEasyRequest: a thread safe, reference counting, auto-cleaning curl easy handle.
|
||||||
class AICurlEasyRequest {
|
class AICurlEasyRequest {
|
||||||
public:
|
public:
|
||||||
// Initial construction is allowed (thread-safe).
|
// Initial construction is allowed (thread-safe).
|
||||||
// Note: If ThreadSafeCurlEasyRequest() throws then the memory allocated is still freed.
|
// Note: If ThreadSafeCurlEasyRequest() throws then the memory allocated is still freed.
|
||||||
// 'new' never returned however and the constructor nor destructor of mCurlEasyRequest is called in this case.
|
// 'new' never returned however and neither the constructor nor destructor of mCurlEasyRequest is called in this case.
|
||||||
// This might throw AICurlNoEasyHandle.
|
// This might throw AICurlNoEasyHandle.
|
||||||
AICurlEasyRequest(bool buffered) :
|
AICurlEasyRequest(bool buffered) :
|
||||||
mCurlEasyRequest(buffered ? new AICurlPrivate::ThreadSafeBufferedCurlEasyRequest : new AICurlPrivate::ThreadSafeCurlEasyRequest) { }
|
mCurlEasyRequest(buffered ? new AICurlPrivate::ThreadSafeBufferedCurlEasyRequest : new AICurlPrivate::ThreadSafeCurlEasyRequest) { }
|
||||||
@@ -295,7 +295,7 @@ class AICurlEasyRequest {
|
|||||||
|
|
||||||
// If we have a correct (with regard to reference counting) AICurlPrivate::CurlEasyRequestPtr,
|
// If we have a correct (with regard to reference counting) AICurlPrivate::CurlEasyRequestPtr,
|
||||||
// then it's OK to construct a AICurlEasyRequest from it.
|
// then it's OK to construct a AICurlEasyRequest from it.
|
||||||
// Note that the external AICurlPrivate::CurlEasyRequestPtr needs it's own locking, because
|
// Note that the external AICurlPrivate::CurlEasyRequestPtr needs its own locking, because
|
||||||
// it's not thread-safe in itself.
|
// it's not thread-safe in itself.
|
||||||
AICurlEasyRequest(AICurlPrivate::CurlEasyRequestPtr const& ptr) : mCurlEasyRequest(ptr) { }
|
AICurlEasyRequest(AICurlPrivate::CurlEasyRequestPtr const& ptr) : mCurlEasyRequest(ptr) { }
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class CurlEasyHandle : public boost::noncopyable, protected AICurlEasyHandleEven
|
|||||||
CURLMcode remove_handle_from_multi(AICurlEasyRequest_wat& curl_easy_request_w, CURLM* multi_handle);
|
CURLMcode remove_handle_from_multi(AICurlEasyRequest_wat& curl_easy_request_w, CURLM* multi_handle);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Retuns total number of existing CURL* handles (excluding ones created outside this class).
|
// Returns total number of existing CURL* handles (excluding ones created outside this class).
|
||||||
static U32 getTotalEasyHandles(void) { return sTotalEasyHandles; }
|
static U32 getTotalEasyHandles(void) { return sTotalEasyHandles; }
|
||||||
|
|
||||||
// Returns true if this easy handle was added to a curl multi handle.
|
// Returns true if this easy handle was added to a curl multi handle.
|
||||||
@@ -114,7 +114,7 @@ class CurlEasyHandle : public boost::noncopyable, protected AICurlEasyHandleEven
|
|||||||
bool operator==(CURL* easy_handle) const { return mEasyHandle == easy_handle; }
|
bool operator==(CURL* easy_handle) const { return mEasyHandle == easy_handle; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Return the underlaying curl easy handle.
|
// Return the underlying curl easy handle.
|
||||||
CURL* getEasyHandle(void) const { return mEasyHandle; }
|
CURL* getEasyHandle(void) const { return mEasyHandle; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -149,7 +149,7 @@ class CurlEasyRequest : public CurlEasyHandle {
|
|||||||
void addHeader(char const* str);
|
void addHeader(char const* str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Call back stubs.
|
// Callback stubs.
|
||||||
static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
||||||
static size_t writeCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
static size_t writeCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
||||||
static size_t readCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
static size_t readCallback(char* ptr, size_t size, size_t nmemb, void* userdata);
|
||||||
@@ -217,7 +217,7 @@ class CurlEasyRequest : public CurlEasyHandle {
|
|||||||
~CurlEasyRequest();
|
~CurlEasyRequest();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Post initialization, set the parent to which to pass the events to.
|
// Post-initialization, set the parent to pass the events to.
|
||||||
void send_events_to(AICurlEasyHandleEvents* target) { mEventsTarget = target; }
|
void send_events_to(AICurlEasyHandleEvents* target) { mEventsTarget = target; }
|
||||||
|
|
||||||
// For debugging purposes
|
// For debugging purposes
|
||||||
@@ -237,7 +237,7 @@ class CurlEasyRequest : public CurlEasyHandle {
|
|||||||
// Curl callbacks write into and read from these buffers.
|
// Curl callbacks write into and read from these buffers.
|
||||||
// The interface with the rest of the code is through AICurlInterface::Responder.
|
// The interface with the rest of the code is through AICurlInterface::Responder.
|
||||||
//
|
//
|
||||||
// The life time of a CurlResponderBuffer is slightly shorter than it's
|
// The lifetime of a CurlResponderBuffer is slightly shorter than its
|
||||||
// associated CurlEasyRequest; this class can only be created as base class
|
// associated CurlEasyRequest; this class can only be created as base class
|
||||||
// of ThreadSafeBufferedCurlEasyRequest, and is therefore constructed after
|
// of ThreadSafeBufferedCurlEasyRequest, and is therefore constructed after
|
||||||
// the construction of the associated CurlEasyRequest and destructed before it.
|
// the construction of the associated CurlEasyRequest and destructed before it.
|
||||||
@@ -311,8 +311,8 @@ class ThreadSafeCurlEasyRequest : public AIThreadSafeSimple<CurlEasyRequest> {
|
|||||||
friend void intrusive_ptr_release(ThreadSafeCurlEasyRequest* p); // Called by boost::intrusive_ptr when a boost::intrusive_ptr<ThreadSafeCurlEasyRequest> is destroyed.
|
friend void intrusive_ptr_release(ThreadSafeCurlEasyRequest* p); // Called by boost::intrusive_ptr when a boost::intrusive_ptr<ThreadSafeCurlEasyRequest> is destroyed.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Same as the above but adds a CurlResponderBuffer. The latter has it's own locking in order to
|
// Same as the above but adds a CurlResponderBuffer. The latter has its own locking in order to
|
||||||
// allow casting the underlaying CurlEasyRequest to ThreadSafeCurlEasyRequest, independent of
|
// allow casting the underlying CurlEasyRequest to ThreadSafeCurlEasyRequest, independent of
|
||||||
// what class it is part of: ThreadSafeCurlEasyRequest or ThreadSafeBufferedCurlEasyRequest.
|
// what class it is part of: ThreadSafeCurlEasyRequest or ThreadSafeBufferedCurlEasyRequest.
|
||||||
// The virtual destructor of ThreadSafeCurlEasyRequest allows to treat each easy handle transparently
|
// The virtual destructor of ThreadSafeCurlEasyRequest allows to treat each easy handle transparently
|
||||||
// as a ThreadSafeCurlEasyRequest object, or optionally dynamic_cast it to a ThreadSafeBufferedCurlEasyRequest.
|
// as a ThreadSafeCurlEasyRequest object, or optionally dynamic_cast it to a ThreadSafeBufferedCurlEasyRequest.
|
||||||
|
|||||||
@@ -115,9 +115,9 @@ namespace curlthread {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PollSet
|
// PollSet
|
||||||
|
|
||||||
// A PollSet can store at least 1024 file descriptors, or FD_SETSIZE if that is larger than 1024 [MAXSIZE].
|
// A PollSet can store at least 1024 filedescriptors, or FD_SETSIZE if that is larger than 1024 [MAXSIZE].
|
||||||
// The number of stored file descriptors is mNrFds [0 <= mNrFds <= MAXSIZE].
|
// The number of stored filedescriptors is mNrFds [0 <= mNrFds <= MAXSIZE].
|
||||||
// The largest file descriptor is stored is mMaxFd, which is -1 iff mNrFds == 0.
|
// The largest filedescriptor is stored is mMaxFd, which is -1 iff mNrFds == 0.
|
||||||
// The file descriptors are stored contiguous in mFileDescriptors[i], with 0 <= i < mNrFds.
|
// The file descriptors are stored contiguous in mFileDescriptors[i], with 0 <= i < mNrFds.
|
||||||
// File descriptors with the highest priority should be stored first (low index).
|
// File descriptors with the highest priority should be stored first (low index).
|
||||||
//
|
//
|
||||||
@@ -126,7 +126,7 @@ namespace curlthread {
|
|||||||
//
|
//
|
||||||
// After a call to refresh():
|
// After a call to refresh():
|
||||||
//
|
//
|
||||||
// mFdSet has bits set for at most FD_SETSIZE - 1 file descriptors, copied from mFileDescriptors starting
|
// mFdSet has bits set for at most FD_SETSIZE - 1 filedescriptors, copied from mFileDescriptors starting
|
||||||
// at index mNext (wrapping around to 0). If mNrFds < FD_SETSIZE then mNext is reset to 0 before copying starts.
|
// at index mNext (wrapping around to 0). If mNrFds < FD_SETSIZE then mNext is reset to 0 before copying starts.
|
||||||
// If mNrFds >= FD_SETSIZE then mNext is set to the next filedescriptor that was not copied (otherwise it is left at 0).
|
// If mNrFds >= FD_SETSIZE then mNext is set to the next filedescriptor that was not copied (otherwise it is left at 0).
|
||||||
//
|
//
|
||||||
@@ -139,7 +139,7 @@ PollSet::PollSet(void) : mFileDescriptors(new curl_socket_t [std::max(1024, FD_S
|
|||||||
FD_ZERO(&mFdSet);
|
FD_ZERO(&mFdSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add file descriptor s to the PollSet.
|
// Add filedescriptor s to the PollSet.
|
||||||
void PollSet::add(curl_socket_t s)
|
void PollSet::add(curl_socket_t s)
|
||||||
{
|
{
|
||||||
llassert_always(mNrFds < mSize);
|
llassert_always(mNrFds < mSize);
|
||||||
@@ -147,7 +147,7 @@ void PollSet::add(curl_socket_t s)
|
|||||||
mMaxFd = std::max(mMaxFd, s);
|
mMaxFd = std::max(mMaxFd, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove file descriptor s from the PollSet.
|
// Remove filedescriptor s from the PollSet.
|
||||||
void PollSet::remove(curl_socket_t s)
|
void PollSet::remove(curl_socket_t s)
|
||||||
{
|
{
|
||||||
// The number of open filedescriptors is relatively small,
|
// The number of open filedescriptors is relatively small,
|
||||||
@@ -220,8 +220,8 @@ refresh_t PollSet::refresh(void)
|
|||||||
|
|
||||||
llassert_always(mNext < mNrFds);
|
llassert_always(mNext < mNrFds);
|
||||||
|
|
||||||
// Test if mNrFds is larger or equal FD_SETSIZE; equal, because we reserve one
|
// Test if mNrFds is larger than or equal FD_SETSIZE; equal, because we reserve one
|
||||||
// file descriptor for the wakeup fd: we copy maximal FD_SETSIZE - 1 file descriptors.
|
// filedescriptor for the wakeup fd: we copy maximal FD_SETSIZE - 1 filedescriptors.
|
||||||
// If not then we're going to copy everything so that we can save on CPU cycles
|
// If not then we're going to copy everything so that we can save on CPU cycles
|
||||||
// by not calculating mMaxFdSet here.
|
// by not calculating mMaxFdSet here.
|
||||||
if (mNrFds >= FD_SETSIZE)
|
if (mNrFds >= FD_SETSIZE)
|
||||||
@@ -278,8 +278,8 @@ refresh_t PollSet::refresh(void)
|
|||||||
return complete_not_empty;
|
return complete_not_empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This needs a rewrite on windows, as FD_ISSET is slow there; it would make
|
// FIXME: This needs a rewrite on Windows, as FD_ISSET is slow there; it would make
|
||||||
// more sense to iterate directly over the fd's in mFdSet on windows.
|
// more sense to iterate directly over the fd's in mFdSet on Windows.
|
||||||
void PollSet::reset(void)
|
void PollSet::reset(void)
|
||||||
{
|
{
|
||||||
llassert((mNrFds == 0) == mCopiedFileDescriptors.empty());
|
llassert((mNrFds == 0) == mCopiedFileDescriptors.empty());
|
||||||
@@ -298,8 +298,8 @@ inline int PollSet::get(void) const
|
|||||||
return (mIter == mCopiedFileDescriptors.end()) ? -1 : *mIter;
|
return (mIter == mCopiedFileDescriptors.end()) ? -1 : *mIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: This needs a rewrite on windows, as FD_ISSET is slow there; it would make
|
// FIXME: This needs a rewrite on Windows, as FD_ISSET is slow there; it would make
|
||||||
// more sense to iterate directly over the fd's in mFdSet on windows.
|
// more sense to iterate directly over the fd's in mFdSet on Windows.
|
||||||
void PollSet::next(void)
|
void PollSet::next(void)
|
||||||
{
|
{
|
||||||
llassert(mIter != mCopiedFileDescriptors.end()); // Only call next() if the last call to get() didn't return -1.
|
llassert(mIter != mCopiedFileDescriptors.end()); // Only call next() if the last call to get() didn't return -1.
|
||||||
@@ -476,7 +476,7 @@ AICurlThread::~AICurlThread()
|
|||||||
void AICurlThread::create_wakeup_fds(void)
|
void AICurlThread::create_wakeup_fds(void)
|
||||||
{
|
{
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
// Probably need to use sockets here, cause windows select doesn't work for a pipe.
|
// Probably need to use sockets here, cause Windows select doesn't work for a pipe.
|
||||||
#error Missing implementation
|
#error Missing implementation
|
||||||
#else
|
#else
|
||||||
int pipefd[2];
|
int pipefd[2];
|
||||||
@@ -626,7 +626,7 @@ void AICurlThread::run(void)
|
|||||||
int nfds = std::max(max_rfd, max_wfd) + 1;
|
int nfds = std::max(max_rfd, max_wfd) + 1;
|
||||||
llassert(0 <= nfds && nfds <= FD_SETSIZE);
|
llassert(0 <= nfds && nfds <= FD_SETSIZE);
|
||||||
llassert((max_rfd == -1) == (read_fd_set == NULL) &&
|
llassert((max_rfd == -1) == (read_fd_set == NULL) &&
|
||||||
(max_wfd == -1) == (write_fd_set == NULL)); // Needed on windows.
|
(max_wfd == -1) == (write_fd_set == NULL)); // Needed on Windows.
|
||||||
llassert((max_rfd == -1 || multi_handle_w->mReadPollSet.is_set(max_rfd)) &&
|
llassert((max_rfd == -1 || multi_handle_w->mReadPollSet.is_set(max_rfd)) &&
|
||||||
(max_wfd == -1 || multi_handle_w->mWritePollSet.is_set(max_wfd)));
|
(max_wfd == -1 || multi_handle_w->mWritePollSet.is_set(max_wfd)));
|
||||||
int ready = 0;
|
int ready = 0;
|
||||||
@@ -971,7 +971,7 @@ void AICurlEasyRequest::addRequest(void)
|
|||||||
command_being_processed_rat command_being_processed_r(command_being_processed);
|
command_being_processed_rat command_being_processed_r(command_being_processed);
|
||||||
if (*command_being_processed_r == *this)
|
if (*command_being_processed_r == *this)
|
||||||
{
|
{
|
||||||
// May not be inbetween being removed from the command queue but not added to the multi session handle yet.
|
// May not be in-between being removed from the command queue but not added to the multi session handle yet.
|
||||||
llassert(command_being_processed_r->command() == cmd_remove);
|
llassert(command_being_processed_r->command() == cmd_remove);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1020,7 +1020,7 @@ void AICurlEasyRequest::removeRequest(void)
|
|||||||
command_being_processed_rat command_being_processed_r(command_being_processed);
|
command_being_processed_rat command_being_processed_r(command_being_processed);
|
||||||
if (*command_being_processed_r == *this)
|
if (*command_being_processed_r == *this)
|
||||||
{
|
{
|
||||||
// May not be inbetween being removed from the command queue but not removed from the multi session handle yet.
|
// May not be in-between being removed from the command queue but not removed from the multi session handle yet.
|
||||||
llassert(command_being_processed_r->command() != cmd_remove);
|
llassert(command_being_processed_r->command() != cmd_remove);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class PollSet
|
|||||||
fd_set mFdSet; // Output variable for select(). (Re)initialized by calling refresh().
|
fd_set mFdSet; // Output variable for select(). (Re)initialized by calling refresh().
|
||||||
int mMaxFdSet; // The largest filedescriptor set in mFdSet by refresh(), or -1 when it was empty.
|
int mMaxFdSet; // The largest filedescriptor set in mFdSet by refresh(), or -1 when it was empty.
|
||||||
|
|
||||||
std::vector<curl_socket_t> mCopiedFileDescriptors; // File descriptors copied by refresh to mFdSet.
|
std::vector<curl_socket_t> mCopiedFileDescriptors; // Filedescriptors copied by refresh to mFdSet.
|
||||||
std::vector<curl_socket_t>::iterator mIter; // Index into mCopiedFileDescriptors for next(); loop variable.
|
std::vector<curl_socket_t>::iterator mIter; // Index into mCopiedFileDescriptors for next(); loop variable.
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ class MultiHandle : public CurlMultiHandle
|
|||||||
bool mHandleAddedOrRemoved; // Set when an easy handle was added or removed, reset in check_run_count().
|
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 mPrevRunningHandles; // The last value of mRunningHandles that check_run_count() was called with.
|
||||||
int mRunningHandles; // The last value returned by curl_multi_socket_action.
|
int mRunningHandles; // The last value returned by curl_multi_socket_action.
|
||||||
long mTimeOut; // The last time out in ms as set by the call back CURLMOPT_TIMERFUNCTION.
|
long mTimeOut; // The last time out in ms as set by the callback CURLMOPT_TIMERFUNCTION.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int socket_callback(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp);
|
static int socket_callback(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
#include "llares.h"
|
#include "llares.h"
|
||||||
#include "llscopedvolatileaprpool.h"
|
|
||||||
|
|
||||||
#include <ares_dns.h>
|
#include <ares_dns.h>
|
||||||
#include <ares_version.h>
|
#include <ares_version.h>
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ S32 LLProxy::proxyHandshake(LLHost proxy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Write acccess type and read access type are really the same, so unshared_w must be simply a reference.
|
// Write access type and read access type are really the same, so unshared_w must be simply a reference.
|
||||||
Unshared_wat& unshared_w = unshared_r;
|
Unshared_wat& unshared_w = unshared_r;
|
||||||
unshared_w->mUDPProxy.setPort(ntohs(connect_reply.port)); // reply port is in network byte order
|
unshared_w->mUDPProxy.setPort(ntohs(connect_reply.port)); // reply port is in network byte order
|
||||||
unshared_w->mUDPProxy.setAddress(proxy.getAddress());
|
unshared_w->mUDPProxy.setAddress(proxy.getAddress());
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ struct ProxyShared
|
|||||||
// HTTP proxy address and port
|
// HTTP proxy address and port
|
||||||
LLHost mHTTPProxy;
|
LLHost mHTTPProxy;
|
||||||
|
|
||||||
// Currently selected HTTP proxy type. Can be web or socks.
|
// Currently selected HTTP proxy type. Can be web or SOCKS.
|
||||||
LLHttpProxyType mProxyType;
|
LLHttpProxyType mProxyType;
|
||||||
|
|
||||||
// SOCKS 5 selected authentication method.
|
// SOCKS 5 selected authentication method.
|
||||||
|
|||||||
@@ -801,10 +801,10 @@ class Linux_i686Manifest(LinuxManifest):
|
|||||||
self.path("libapr-1.so.0")
|
self.path("libapr-1.so.0")
|
||||||
self.path("libaprutil-1.so.0")
|
self.path("libaprutil-1.so.0")
|
||||||
self.path("libdb-4.2.so")
|
self.path("libdb-4.2.so")
|
||||||
self.path("libcrypto.so.0.9.7")
|
self.path("libcrypto.so.1.0.0")
|
||||||
self.path("libexpat.so.1")
|
self.path("libexpat.so.1")
|
||||||
self.path("libhunspell-1.2.so.0.0.0", "libhunspell-1.2.so.0")
|
self.path("libhunspell-1.2.so.0.0.0", "libhunspell-1.2.so.0")
|
||||||
self.path("libssl.so.0.9.7")
|
self.path("libssl.so.1.0.0")
|
||||||
#self.path("libuuid.so.1")
|
#self.path("libuuid.so.1")
|
||||||
self.path("libSDL-1.2.so.0")
|
self.path("libSDL-1.2.so.0")
|
||||||
self.path("libELFIO.so")
|
self.path("libELFIO.so")
|
||||||
@@ -836,10 +836,10 @@ class Linux_x86_64Manifest(LinuxManifest):
|
|||||||
self.path("libapr-1.so.0")
|
self.path("libapr-1.so.0")
|
||||||
self.path("libaprutil-1.so.0")
|
self.path("libaprutil-1.so.0")
|
||||||
self.path("libdb-4.2.so")
|
self.path("libdb-4.2.so")
|
||||||
self.path("libcrypto.so.0.9.8")
|
self.path("libcrypto.so.1.0.0")
|
||||||
self.path("libexpat.so.1")
|
self.path("libexpat.so.1")
|
||||||
self.path("libhunspell-1.2.so.0.0.0", "libhunspell-1.2.so.0")
|
self.path("libhunspell-1.2.so.0.0.0", "libhunspell-1.2.so.0")
|
||||||
self.path("libssl.so.0.9.8")
|
self.path("libssl.so.1.0.0")
|
||||||
self.path("libuuid.so", "libuuid.so.1")
|
self.path("libuuid.so", "libuuid.so.1")
|
||||||
self.path("libSDL-1.2.so.0")
|
self.path("libSDL-1.2.so.0")
|
||||||
self.path("libELFIO.so")
|
self.path("libELFIO.so")
|
||||||
|
|||||||
@@ -1069,16 +1069,16 @@ anguage Infrstructure (CLI) international standard</string>
|
|||||||
<key>linux</key>
|
<key>linux</key>
|
||||||
<map>
|
<map>
|
||||||
<key>md5sum</key>
|
<key>md5sum</key>
|
||||||
<string>f219ef07b02e2abb9282345c3a8f2b39</string>
|
<string>613856e3880c5898f9629f9f7eb3545c</string>
|
||||||
<key>url</key>
|
<key>url</key>
|
||||||
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.7c-linux-20080812.tar.bz2</uri>
|
<uri>https://bitbucket.org/Lirusaito/singularityviewer/downloads/openssl-1.0.0d-linux-20110418.tar.bz2</uri>
|
||||||
</map>
|
</map>
|
||||||
<key>linux64</key>
|
<key>linux64</key>
|
||||||
<map>
|
<map>
|
||||||
<key>md5sum</key>
|
<key>md5sum</key>
|
||||||
<string>00b23f28a2457d9dabbaff0b29ee7323</string>
|
<string>5785bec161f1ad3069fa8330ba42f404</string>
|
||||||
<key>url</key>
|
<key>url</key>
|
||||||
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/openSSL-0.9.8g-linux64-20080909.tar.bz2</uri>
|
<uri>https://bitbucket.org/Lirusaito/singularityviewer/downloads/openSSL-1.0.0d-linux64-for-singularity.tar.bz2</uri>
|
||||||
</map>
|
</map>
|
||||||
<key>windows</key>
|
<key>windows</key>
|
||||||
<map>
|
<map>
|
||||||
|
|||||||
Reference in New Issue
Block a user