From 433c7c3f99deea67f1d09f8b75dd88a2e733f90b Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 28 Jun 2012 04:08:25 -0400 Subject: [PATCH] Spelling fixes and stuff like that to AICurl* and llproxy.* documentations Also removes a duplicate include from llares.cpp Conflicts: indra/llmessage/aicurl.cpp --- indra/llmessage/aicurl.cpp | 20 ++++++++++---------- indra/llmessage/aicurl.h | 22 +++++++++++----------- indra/llmessage/aicurlprivate.h | 14 +++++++------- indra/llmessage/aicurlthread.cpp | 32 ++++++++++++++++---------------- indra/llmessage/aicurlthread.h | 4 ++-- indra/llmessage/llares.cpp | 1 - indra/llmessage/llproxy.cpp | 2 +- indra/llmessage/llproxy.h | 2 +- 8 files changed, 48 insertions(+), 49 deletions(-) diff --git a/indra/llmessage/aicurl.cpp b/indra/llmessage/aicurl.cpp index 3ab86f56f..9a60ee52d 100644 --- a/indra/llmessage/aicurl.cpp +++ b/indra/llmessage/aicurl.cpp @@ -187,7 +187,7 @@ void ssl_init(void) CRYPTO_set_dynlock_destroy_callback(&ssl_dyn_destroy_function); } -// Cleanup OpenSLL library thread-safety. +// Cleanup OpenSSL library thread-safety. void ssl_cleanup(void) { // Dynamic locks callbacks. @@ -844,7 +844,7 @@ void CurlEasyRequest::applyDefaultOptions(void) setoptString(CURLOPT_CAINFO, CertificateAuthority_r->file); // 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 - // 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. // 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 @@ -854,12 +854,12 @@ void CurlEasyRequest::applyDefaultOptions(void) setopt(CURLOPT_NOSIGNAL, 1); // The old code did this for the 'buffered' version, but I think it's nonsense. //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(); Debug( 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_DEBUGDATA, this); } @@ -874,11 +874,11 @@ void CurlEasyRequest::finalizeRequest(std::string const& url) lldebugs << url << llendl; setopt(CURLOPT_HTTPHEADER, mHeaders); 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 // 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(), - // 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.] // 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 @@ -953,7 +953,7 @@ CurlResponderBuffer::CurlResponderBuffer() CurlResponderBuffer::~CurlResponderBuffer() { 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->revokeCallbacks(); if (mResponder) @@ -1042,7 +1042,7 @@ size_t CurlResponderBuffer::curlWriteCallback(char* data, size_t size, size_t nm ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast(user_data); // 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); AICurlResponderBuffer_wat buffer_w(*lockobj); @@ -1057,7 +1057,7 @@ size_t CurlResponderBuffer::curlReadCallback(char* data, size_t size, size_t nme ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast(user_data); // 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); AICurlResponderBuffer_wat buffer_w(*lockobj); @@ -1078,7 +1078,7 @@ size_t CurlResponderBuffer::curlHeaderCallback(char* data, size_t size, size_t n ThreadSafeBufferedCurlEasyRequest* lockobj = static_cast(user_data); // 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); AICurlResponderBuffer_wat buffer_w(*lockobj); diff --git a/indra/llmessage/aicurl.h b/indra/llmessage/aicurl.h index ffff2a01e..a0ab05408 100644 --- a/indra/llmessage/aicurl.h +++ b/indra/llmessage/aicurl.h @@ -125,19 +125,19 @@ void setCAPath(std::string const& file); // 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, // 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 -// member mResponder. Hence, the life time of a Responder is never longer than it's -// associated CurlResponderBuffer, however, if everything works correct, then normally a +// 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 its +// associated CurlResponderBuffer, however, if everything works correctly, then normally a // responder is deleted in CurlResponderBuffer::removed_from_multi_handle by setting // 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) // and the callbacks, as set by prepRequest, only use those two. // A callback locks the CurlEasyRequest before actually making the callback, and the // 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 -// 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. // class Responder { @@ -150,8 +150,8 @@ class Responder { std::string mURL; public: - // Called to set the url of the current request for this responder, - // used only when printing debug output regarding activity of the responder. + // Called to set the URL of the current request for this Responder, + // used only when printing debug output regarding activity of the Responder. void setURL(std::string const& url); public: @@ -193,7 +193,7 @@ class Responder { public: // 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 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 // 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 { public: // Initial construction is allowed (thread-safe). // 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. AICurlEasyRequest(bool buffered) : 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, // 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. AICurlEasyRequest(AICurlPrivate::CurlEasyRequestPtr const& ptr) : mCurlEasyRequest(ptr) { } diff --git a/indra/llmessage/aicurlprivate.h b/indra/llmessage/aicurlprivate.h index fcf51e927..c5843176d 100644 --- a/indra/llmessage/aicurlprivate.h +++ b/indra/llmessage/aicurlprivate.h @@ -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); 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; } // 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; } protected: - // Return the underlaying curl easy handle. + // Return the underlying curl easy handle. CURL* getEasyHandle(void) const { return mEasyHandle; } private: @@ -149,7 +149,7 @@ class CurlEasyRequest : public CurlEasyHandle { void addHeader(char const* str); private: - // Call back stubs. + // Callback stubs. 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 readCallback(char* ptr, size_t size, size_t nmemb, void* userdata); @@ -217,7 +217,7 @@ class CurlEasyRequest : public CurlEasyHandle { ~CurlEasyRequest(); 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; } // For debugging purposes @@ -237,7 +237,7 @@ class CurlEasyRequest : public CurlEasyHandle { // Curl callbacks write into and read from these buffers. // 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 // of ThreadSafeBufferedCurlEasyRequest, and is therefore constructed after // the construction of the associated CurlEasyRequest and destructed before it. @@ -311,8 +311,8 @@ class ThreadSafeCurlEasyRequest : public AIThreadSafeSimple { friend void intrusive_ptr_release(ThreadSafeCurlEasyRequest* p); // Called by boost::intrusive_ptr when a boost::intrusive_ptr is destroyed. }; -// Same as the above but adds a CurlResponderBuffer. The latter has it's own locking in order to -// allow casting the underlaying CurlEasyRequest to ThreadSafeCurlEasyRequest, independent of +// Same as the above but adds a CurlResponderBuffer. The latter has its own locking in order to +// allow casting the underlying CurlEasyRequest to ThreadSafeCurlEasyRequest, independent of // what class it is part of: ThreadSafeCurlEasyRequest or ThreadSafeBufferedCurlEasyRequest. // The virtual destructor of ThreadSafeCurlEasyRequest allows to treat each easy handle transparently // as a ThreadSafeCurlEasyRequest object, or optionally dynamic_cast it to a ThreadSafeBufferedCurlEasyRequest. diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index 6b2d1d68d..7e51ee5b5 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -115,9 +115,9 @@ namespace curlthread { //----------------------------------------------------------------------------- // PollSet -// A PollSet can store at least 1024 file descriptors, or FD_SETSIZE if that is larger than 1024 [MAXSIZE]. -// The number of stored file descriptors is mNrFds [0 <= mNrFds <= MAXSIZE]. -// The largest file descriptor is stored is mMaxFd, which is -1 iff mNrFds == 0. +// A PollSet can store at least 1024 filedescriptors, or FD_SETSIZE if that is larger than 1024 [MAXSIZE]. +// The number of stored filedescriptors is mNrFds [0 <= mNrFds <= MAXSIZE]. +// 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. // File descriptors with the highest priority should be stored first (low index). // @@ -126,7 +126,7 @@ namespace curlthread { // // 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. // 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); } -// Add file descriptor s to the PollSet. +// Add filedescriptor s to the PollSet. void PollSet::add(curl_socket_t s) { llassert_always(mNrFds < mSize); @@ -147,7 +147,7 @@ void PollSet::add(curl_socket_t 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) { // The number of open filedescriptors is relatively small, @@ -220,8 +220,8 @@ refresh_t PollSet::refresh(void) llassert_always(mNext < mNrFds); - // Test if mNrFds is larger or equal FD_SETSIZE; equal, because we reserve one - // file descriptor for the wakeup fd: we copy maximal FD_SETSIZE - 1 file descriptors. + // Test if mNrFds is larger than or equal FD_SETSIZE; equal, because we reserve one + // 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 // by not calculating mMaxFdSet here. if (mNrFds >= FD_SETSIZE) @@ -278,8 +278,8 @@ refresh_t PollSet::refresh(void) return complete_not_empty; } -// 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. +// 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. void PollSet::reset(void) { llassert((mNrFds == 0) == mCopiedFileDescriptors.empty()); @@ -298,8 +298,8 @@ inline int PollSet::get(void) const return (mIter == mCopiedFileDescriptors.end()) ? -1 : *mIter; } -// 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. +// 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. void PollSet::next(void) { 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) { #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 #else int pipefd[2]; @@ -626,7 +626,7 @@ void AICurlThread::run(void) int nfds = std::max(max_rfd, max_wfd) + 1; llassert(0 <= nfds && nfds <= FD_SETSIZE); 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)) && (max_wfd == -1 || multi_handle_w->mWritePollSet.is_set(max_wfd))); int ready = 0; @@ -971,7 +971,7 @@ void AICurlEasyRequest::addRequest(void) command_being_processed_rat command_being_processed_r(command_being_processed); 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); } else @@ -1020,7 +1020,7 @@ void AICurlEasyRequest::removeRequest(void) command_being_processed_rat command_being_processed_r(command_being_processed); 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); } else diff --git a/indra/llmessage/aicurlthread.h b/indra/llmessage/aicurlthread.h index 448e53ac0..e8b080b94 100644 --- a/indra/llmessage/aicurlthread.h +++ b/indra/llmessage/aicurlthread.h @@ -100,7 +100,7 @@ class PollSet 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. - std::vector mCopiedFileDescriptors; // File descriptors copied by refresh to mFdSet. + std::vector mCopiedFileDescriptors; // Filedescriptors copied by refresh to mFdSet. std::vector::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(). 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 call back CURLMOPT_TIMERFUNCTION. + long mTimeOut; // The last time out in ms as set by the callback CURLMOPT_TIMERFUNCTION. private: static int socket_callback(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp); diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index 3328f2fd5..d83cd6a37 100644 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -28,7 +28,6 @@ #include "linden_common.h" #include "llares.h" -#include "llscopedvolatileaprpool.h" #include #include diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index a82ae3cc7..d46c70f04 100644 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -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_w->mUDPProxy.setPort(ntohs(connect_reply.port)); // reply port is in network byte order unshared_w->mUDPProxy.setAddress(proxy.getAddress()); diff --git a/indra/llmessage/llproxy.h b/indra/llmessage/llproxy.h index c0d6ab183..00bfa1ad4 100644 --- a/indra/llmessage/llproxy.h +++ b/indra/llmessage/llproxy.h @@ -244,7 +244,7 @@ struct ProxyShared // HTTP proxy address and port LLHost mHTTPProxy; - // Currently selected HTTP proxy type. Can be web or socks. + // Currently selected HTTP proxy type. Can be web or SOCKS. LLHttpProxyType mProxyType; // SOCKS 5 selected authentication method.