diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 5eaca5c32..f422ed4ae 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -29,7 +29,7 @@ if (WINDOWS) # Don't build DLLs. set(BUILD_SHARED_LIBS OFF) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /arch:SSE2" + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP /arch:SSE2" CACHE STRING "C++ compiler debug options" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP /arch:SSE2" diff --git a/indra/cwdebug/debug.cc b/indra/cwdebug/debug.cc index ed1384306..17d86d77f 100644 --- a/indra/cwdebug/debug.cc +++ b/indra/cwdebug/debug.cc @@ -239,6 +239,7 @@ void stop_recording_backtraces(void) channel_ct curl DDCN("CURL"); //!< This debug channel is used for output related to AICurl. channel_ct curlio DDCN("CURLIO"); //!< This debug channel is used to print debug output of libcurl. This includes all HTTP network traffic. channel_ct curltr DDCN("CURLTR"); //!< This debug channel is used to print libcurl API calls. + channel_ct snapshot DDCN("SNAPSHOT"); //!< This debug channel is used for output related to snapshots. } // namespace dc } // namespace DEBUGCHANNELS diff --git a/indra/cwdebug/debug.h b/indra/cwdebug/debug.h index c1b509946..329f0448e 100644 --- a/indra/cwdebug/debug.h +++ b/indra/cwdebug/debug.h @@ -208,6 +208,7 @@ extern CWD_API channel_ct caps; extern CWD_API channel_ct curl; extern CWD_API channel_ct curlio; extern CWD_API channel_ct curltr; +extern CWD_API channel_ct snapshot; #endif diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 36f64bace..cbd86fd29 100644 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h @@ -136,11 +136,11 @@ const int LL_ERR_PRICE_MISMATCH = -23018; // void foo(x, ASSERT_ONLY(int y,) int z); // void foo(x/*,*/ ASSERT_ONLY_COMMA(int y)); // The optional /*,*/ makes it just a bit better readable. #ifdef SHOW_ASSERT -#define ASSERT_ONLY(type_param,...) type_param,##__VA_ARGS__ -#define ASSERT_ONLY_COMMA(type_param,...) , type_param,##__VA_ARGS__ +#define ASSERT_ONLY(...) __VA_ARGS__ +#define ASSERT_ONLY_COMMA(...) , __VA_ARGS__ #else -#define ASSERT_ONLY(type_param,...) -#define ASSERT_ONLY_COMMA(type_param,...) +#define ASSERT_ONLY(...) +#define ASSERT_ONLY_COMMA(...) #endif // handy compile-time assert - enforce those template parameters! diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 2537a4b87..7880271c3 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -60,22 +60,23 @@ extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout; class LLCrashLoggerResponder : public LLHTTPClient::ResponderWithResult { public: - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return crashLoggerResponder_timeout; } - LLCrashLoggerResponder() { } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { gBreak = true; } - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { gBreak = true; gSent = true; } + + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return crashLoggerResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLCrashLoggerResponder"; } }; bool LLCrashLoggerText::mainLoop() diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 8bbb150c4..f3e68b53b 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES aicurlperhost.cpp aicurlthread.cpp aihttpheaders.cpp + aihttptimeout.cpp aihttptimeoutpolicy.cpp debug_libcurl.cpp llhttpclient.cpp @@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES aicurlperhost.h aicurlthread.h aihttpheaders.h + aihttptimeout.h aihttptimeoutpolicy.h debug_libcurl.h llares.h diff --git a/indra/llmessage/aicurl.cpp b/indra/llmessage/aicurl.cpp index cbb5fcc45..2bb76b5ab 100644 --- a/indra/llmessage/aicurl.cpp +++ b/indra/llmessage/aicurl.cpp @@ -1276,7 +1276,7 @@ static int const HTTP_REDIRECTS_DEFAULT = 10; LLChannelDescriptors const BufferedCurlEasyRequest::sChannels; -BufferedCurlEasyRequest::BufferedCurlEasyRequest() : mRequestTransferedBytes(0), mResponseTransferedBytes(0), mBufferEventsTarget(NULL) +BufferedCurlEasyRequest::BufferedCurlEasyRequest() : mRequestTransferedBytes(0), mResponseTransferedBytes(0), mBufferEventsTarget(NULL), mStatus(HTTP_INTERNAL_ERROR) { AICurlInterface::Stats::BufferedCurlEasyRequest_count++; } @@ -1336,8 +1336,13 @@ void BufferedCurlEasyRequest::resetState(void) // Call base class implementation. CurlEasyRequest::resetState(); + // Reset local variables. mOutput.reset(); mInput.reset(); + mRequestTransferedBytes = 0; + mResponseTransferedBytes = 0; + mBufferEventsTarget = NULL; + mStatus = HTTP_INTERNAL_ERROR; } void BufferedCurlEasyRequest::print_diagnostics(CURLcode code) diff --git a/indra/llmessage/aicurlprivate.h b/indra/llmessage/aicurlprivate.h index bd6207e2d..bb39bdddb 100644 --- a/indra/llmessage/aicurlprivate.h +++ b/indra/llmessage/aicurlprivate.h @@ -35,82 +35,15 @@ #include "llatomic.h" #include "llrefcount.h" #include "aicurlperhost.h" +#include "aihttptimeout.h" class AIHTTPHeaders; -class AIHTTPTimeoutPolicy; -class AICurlEasyRequest; class AICurlEasyRequestStateMachine; namespace AICurlPrivate { -class CurlEasyRequest; -class ThreadSafeBufferedCurlEasyRequest; - namespace curlthread { - class MultiHandle; - -// A class that keeps track of timeout administration per connection. -class HTTPTimeout : public LLRefCount { - private: - AIHTTPTimeoutPolicy const* mPolicy; // A pointer to the used timeout policy. - std::vector mBuckets; // An array with the number of bytes transfered in each second. - U16 mBucket; // The bucket corresponding to mLastSecond. - bool mNothingReceivedYet; // Set when created, reset when the HTML reply header from the server is received. - bool mLowSpeedOn; // Set while uploading or downloading data. - bool mUploadFinished; // Used to keep track of whether upload_finished was called yet. - S32 mLastSecond; // The time at which lowspeed() was last called, in seconds since mLowSpeedClock. - U32 mTotalBytes; // The sum of all bytes in mBuckets. - U64 mLowSpeedClock; // Clock count at which low speed detection (re)started. - U64 mStalled; // The clock count at which this transaction is considered to be stalling if nothing is transfered anymore. - public: - static F64 const sClockWidth; // Time between two clock ticks in seconds. - static U64 sClockCount; // Clock count used as 'now' during one loop of the main loop. -#if defined(CWDEBUG) || defined(DEBUG_CURLIO) - ThreadSafeBufferedCurlEasyRequest* mLockObj; -#endif - - public: - HTTPTimeout(AIHTTPTimeoutPolicy const* policy, ThreadSafeBufferedCurlEasyRequest* lock_obj) : - mPolicy(policy), mNothingReceivedYet(true), mLowSpeedOn(false), mUploadFinished(false), mStalled((U64)-1) -#if defined(CWDEBUG) || defined(DEBUG_CURLIO) - , mLockObj(lock_obj) -#endif - { } - - // Called after sending all headers, when body data is written the first time. - void connected(void); - - // Called when everything we had to send to the server has been sent. - void upload_finished(void); - - // Called when data is sent. Returns true if transfer timed out. - bool data_sent(size_t n); - - // Called when data is received. Returns true if transfer timed out. - bool data_received(size_t n); - - // Called immediately before done() after curl finished, with code. - void done(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode code); - - // Accessor. - bool has_stalled(void) const { return mStalled < sClockCount; } - - // Called from BufferedCurlEasyRequest::processOutput if a timeout occurred. - void print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url); - -#if defined(CWDEBUG) || defined(DEBUG_CURLIO) - void* get_lockobj(void) const { return mLockObj; } -#endif - - private: - // (Re)start low speed transer rate detection. - void reset_lowspeed(void); - - // Common low speed detection, Called from data_sent or data_received. - bool lowspeed(size_t bytes); -}; - } // namespace curlthread void handle_multi_error(CURLMcode code); @@ -498,6 +431,9 @@ class BufferedCurlEasyRequest : public CurlEasyRequest { // Return pointer to the ThreadSafe (wrapped) version of this object. ThreadSafeBufferedCurlEasyRequest* get_lockobj(void); ThreadSafeBufferedCurlEasyRequest const* get_lockobj(void) const; + // Return true when an error code was received that can occur before the upload finished. + // So far the only such error I've seen is HTTP_BAD_REQUEST. + bool upload_error_status(void) const { return mStatus == HTTP_BAD_REQUEST /*&& mStatus != HTTP_INTERNAL_ERROR*/; } // Return true when prepRequest was already called and the object has not been // invalidated as a result of calling timed_out(). diff --git a/indra/llmessage/aicurlthread.cpp b/indra/llmessage/aicurlthread.cpp index 6b67733bd..efb5ca46b 100644 --- a/indra/llmessage/aicurlthread.cpp +++ b/indra/llmessage/aicurlthread.cpp @@ -31,6 +31,7 @@ #include "linden_common.h" #include "aicurlthread.h" #include "aihttptimeoutpolicy.h" +#include "aihttptimeout.h" #include "aicurlperhost.h" #include "lltimer.h" // ms_sleep, get_clock_count #include "llhttpstatuscodes.h" @@ -587,7 +588,7 @@ refresh_t PollSet::refresh(void) // If we reached the end and start at the beginning, then we copied everything. if (mNext == 0) break; - // When can only come here if mNrFds >= FD_SETSIZE, hence we can just + // We can only come here if mNrFds >= FD_SETSIZE, hence we can just // wrap around and terminate on count reaching FD_SETSIZE. i = 0; } @@ -1307,28 +1308,7 @@ void AICurlThread::run(void) { // If mRunning is true then we can only get here if mWakeUpFd != CURL_SOCKET_BAD. llassert(mWakeUpFd != CURL_SOCKET_BAD); - // Copy the next batch of file descriptors from the PollSets mFileDescriptors into their mFdSet. - multi_handle_w->mReadPollSet->refresh(); - refresh_t wres = multi_handle_w->mWritePollSet->refresh(); - // Add wake up fd if any, and pass NULL to select() if a set is empty. - fd_set* read_fd_set = multi_handle_w->mReadPollSet->access(); - FD_SET(mWakeUpFd, read_fd_set); - fd_set* write_fd_set = ((wres & empty)) ? NULL : multi_handle_w->mWritePollSet->access(); - // Calculate nfds (ignored on windows). -#if !WINDOWS_CODE - curl_socket_t const max_rfd = llmax(multi_handle_w->mReadPollSet->get_max_fd(), mWakeUpFd); - curl_socket_t const max_wfd = multi_handle_w->mWritePollSet->get_max_fd(); - int nfds = llmax(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. - llassert((max_rfd == -1 || multi_handle_w->mReadPollSet->is_set(max_rfd)) && - (max_wfd == -1 || multi_handle_w->mWritePollSet->is_set(max_wfd))); -#else - int nfds = 64; -#endif - int ready = 0; - // Process every command in command_queue before entering select(). + // Process every command in command_queue before filling the fd_set passed to select(). for(;;) { mWakeUpMutex.lock(); @@ -1346,9 +1326,32 @@ void AICurlThread::run(void) mWakeUpMutex.unlock(); break; } + // If we get here then mWakeUpFlag has been false since we grabbed the lock. // We're now entering select(), during which the main thread will write to the pipe/socket // to wake us up, because it can't get the lock. + + // Copy the next batch of file descriptors from the PollSets mFileDescriptors into their mFdSet. + multi_handle_w->mReadPollSet->refresh(); + refresh_t wres = multi_handle_w->mWritePollSet->refresh(); + // Add wake up fd if any, and pass NULL to select() if a set is empty. + fd_set* read_fd_set = multi_handle_w->mReadPollSet->access(); + FD_SET(mWakeUpFd, read_fd_set); + fd_set* write_fd_set = ((wres & empty)) ? NULL : multi_handle_w->mWritePollSet->access(); + // Calculate nfds (ignored on windows). +#if !WINDOWS_CODE + curl_socket_t const max_rfd = llmax(multi_handle_w->mReadPollSet->get_max_fd(), mWakeUpFd); + curl_socket_t const max_wfd = multi_handle_w->mWritePollSet->get_max_fd(); + int nfds = llmax(max_rfd, max_wfd) + 1; + llassert(1 <= nfds && nfds <= FD_SETSIZE); + llassert((max_rfd == -1) == (read_fd_set == NULL) && + (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))); +#else + int nfds = 64; +#endif + int ready = 0; struct timeval timeout; long timeout_ms = multi_handle_w->getTimeout(); // If no timeout is set, sleep 1 second. @@ -1807,383 +1810,6 @@ void MultiHandle::finish_easy_request(AICurlEasyRequest const& easy_request, CUR curl_easy_request_w->done(curl_easy_request_w, result); } -//----------------------------------------------------------------------------- -// HTTPTimeout - -//static -F64 const HTTPTimeout::sClockWidth = 1.0 / calc_clock_frequency(); // Time between two clock ticks, in seconds. -U64 HTTPTimeout::sClockCount; // Clock count, set once per select() exit. - -// CURL-THREAD -// This is called when body data was sent to the server socket. -// <-----mLowSpeedOn------> -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ ^ ^ ^ ^ ^ -// | | | | | | -bool HTTPTimeout::data_sent(size_t n) -{ - // Generate events. - if (!mLowSpeedOn) - { - // If we can send data (for the first time) then that's our only way to know we connected. - reset_lowspeed(); - } - // Detect low speed. - return lowspeed(n); -} - -// CURL-THREAD -// This is called when the 'low speed' timer should be started. -// <-----mLowSpeedOn------> <-------mLowSpeedOn--------> -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ ^ -// | | -void HTTPTimeout::reset_lowspeed(void) -{ - mLowSpeedClock = sClockCount; - mLowSpeedOn = true; - mLastSecond = -1; // This causes lowspeed to initialize the rest. - mStalled = (U64)-1; // Stop reply delay timer. - DoutCurl("reset_lowspeed: mLowSpeedClock = " << mLowSpeedClock << "; mStalled = -1"); -} - -// CURL-THREAD -// This is called when everything we had to send to the server has been sent. -// <-----mLowSpeedOn------> -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ -// | -void HTTPTimeout::upload_finished(void) -{ - llassert(!mUploadFinished); // If we get here twice, then the 'upload finished' detection failed. - mUploadFinished = true; - // We finished uploading (if there was a body to upload at all), so not more transfer rate timeouts. - mLowSpeedOn = false; - // Timeout if the server doesn't reply quick enough. - mStalled = sClockCount + mPolicy->getReplyDelay() / sClockWidth; - DoutCurl("upload_finished: mStalled set to sClockCount (" << sClockCount << ") + " << (mStalled - sClockCount) << " (" << mPolicy->getReplyDelay() << " seconds)"); -} - -// CURL-THREAD -// This is called when data was received from the server. -// -// <--------------------------------mNothingReceivedYet------------------------------><-------mLowSpeedOn--------> -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ ^ ^ ^ ^ ^ ^ ^ -// | | | | | | | | -bool HTTPTimeout::data_received(size_t n) -{ - // The HTTP header of the reply is the first thing we receive. - if (mNothingReceivedYet && n > 0) - { - if (!mUploadFinished) - { - // mUploadFinished not being set this point should only happen for GET requests (in fact, then it is normal), - // because in that case it is impossible to detect the difference between connecting and waiting for a reply without - // using CURLOPT_DEBUGFUNCTION. Note that mDebugIsHeadOrGetMethod is only valid when the debug channel 'curlio' is on, - // because it is set in the debug callback function. - Debug(llassert(AICurlEasyRequest_wat(*mLockObj)->mDebugIsHeadOrGetMethod || !dc::curlio.is_on())); - // 'Upload finished' detection failed, generate it now. - upload_finished(); - } - // Turn this flag off again now that we received data, so that if 'upload_finished()' is called again - // for a future upload on the same descriptor, then that won't trigger an assert. - // Note that because we also set mNothingReceivedYet here, we won't enter this code block anymore, - // so it's safe to do this. - mUploadFinished = false; - // Mark that something was received. - mNothingReceivedYet = false; - // We received something; switch to getLowSpeedLimit()/getLowSpeedTime(). - reset_lowspeed(); - } - return mLowSpeedOn ? lowspeed(n) : false; -} - -// CURL_THREAD -// bytes is the number of bytes we just sent or received (including headers). -// Returns true if the transfer should be aborted. -// -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ -// | | | | | | | | | | | | | | -bool HTTPTimeout::lowspeed(size_t bytes) -{ - //DoutCurlEntering("HTTPTimeout::lowspeed(" << bytes << ")"); commented out... too spammy for normal use. - - // The algorithm to determine if we timed out if different from how libcurls CURLOPT_LOW_SPEED_TIME works. - // - // libcurl determines the transfer rate since the last call to an equivalent 'lowspeed' function, and then - // triggers a timeout if CURLOPT_LOW_SPEED_TIME long such a transfer value is less than CURLOPT_LOW_SPEED_LIMIT. - // That doesn't work right because once there IS data it can happen that this function is called a few - // times (with less than a milisecond in between) causing seemingly VERY high "transfer rate" spikes. - // The only correct way to determine the transfer rate is to actually average over CURLOPT_LOW_SPEED_TIME - // seconds. - // - // We do this as follows: we create low_speed_time (in seconds) buckets and fill them with the number - // of bytes received during that second. We also keep track of the sum of all bytes received between 'now' - // and 'now - llmax(starttime, low_speed_time)'. Then if that period reaches at least low_speed_time - // seconds, and the transfer rate (sum / low_speed_time) is less than low_speed_limit, we abort. - - // When are we? - S32 second = (sClockCount - mLowSpeedClock) * sClockWidth; - llassert(sClockWidth > 0.0); - // This REALLY should never happen, but due to another bug it did happened - // and caused something so evil and hard to find that... NEVER AGAIN! - llassert(second >= 0); - - // If this is the same second as last time, just add the number of bytes to the current bucket. - if (second == mLastSecond) - { - mTotalBytes += bytes; - mBuckets[mBucket] += bytes; - return false; - } - - // We arrived at a new second. - // The below is at most executed once per second, even though for - // every currently connected transfer, CPU is not a big issue. - - // Determine the number of buckets needed and increase the number of buckets if needed. - U16 const low_speed_time = mPolicy->getLowSpeedTime(); - if (low_speed_time > mBuckets.size()) - { - mBuckets.resize(low_speed_time, 0); - } - - S32 s = mLastSecond; - mLastSecond = second; - - // If this is the first time this function is called, we need to do some initialization. - if (s == -1) - { - mBucket = 0; // It doesn't really matter where we start. - mTotalBytes = bytes; - mBuckets[mBucket] = bytes; - return false; - } - - // Update all administration. - U16 bucket = mBucket; - while(1) // Run over all the seconds that were skipped. - { - if (++bucket == low_speed_time) - bucket = 0; - if (++s == second) - break; - mTotalBytes -= mBuckets[bucket]; - mBuckets[bucket] = 0; - } - mBucket = bucket; - mTotalBytes -= mBuckets[mBucket]; - mTotalBytes += bytes; - mBuckets[mBucket] = bytes; - - // Check if we timed out. - U32 const low_speed_limit = mPolicy->getLowSpeedLimit(); - U32 mintotalbytes = low_speed_limit * low_speed_time; - DoutCurl("Transfered " << mTotalBytes << " bytes in " << llmin(second, (S32)low_speed_time) << " seconds after " << second << " second" << ((second == 1) ? "" : "s") << "."); - if (second >= low_speed_time) - { - DoutCurl("Average transfer rate is " << (mTotalBytes / low_speed_time) << " bytes/s (low speed limit is " << low_speed_limit << " bytes/s)"); - if (mTotalBytes < mintotalbytes) - { - // The average transfer rate over the passed low_speed_time seconds is too low. Abort the transfer. - llwarns << -#ifdef CWDEBUG - (void*)get_lockobj() << ": " -#endif - "aborting slow connection (average transfer rate below " << low_speed_limit << - " for more than " << low_speed_time << " second" << ((low_speed_time == 1) ? "" : "s") << ")." << llendl; - return true; - } - } - - // Calculate how long the data transfer may stall until we should timeout. - llassert_always(mintotalbytes > 0); - S32 max_stall_time = 0; - U32 dropped_bytes = 0; - while(1) - { - if (++bucket == low_speed_time) // The next second the next bucket will be emptied. - bucket = 0; - ++max_stall_time; - dropped_bytes += mBuckets[bucket]; - // Note how, when max_stall_time == low_speed_time, dropped_bytes has - // to be equal to mTotalBytes, the sum of all vector elements. - llassert_always(max_stall_time < low_speed_time || dropped_bytes == mTotalBytes); - // And thus the following will certainly abort. - if (second + max_stall_time >= low_speed_time && mTotalBytes - dropped_bytes < mintotalbytes) - break; - } - // If this function isn't called again within max_stall_time seconds, we stalled. - mStalled = sClockCount + max_stall_time / sClockWidth; - DoutCurl("mStalled set to sClockCount (" << sClockCount << ") + " << (mStalled - sClockCount) << " (" << max_stall_time << " seconds)"); - - return false; -} - -// CURL-THREAD -// This is called immediately before done() after curl finished, with code. -// <-------mLowSpeedOn--------> -// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done -// ^ -// | -void HTTPTimeout::done(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode code) -{ - if (code == CURLE_OPERATION_TIMEDOUT || code == CURLE_COULDNT_RESOLVE_HOST) - { - bool dns_problem = false; - if (code == CURLE_COULDNT_RESOLVE_HOST) - { - // Note that CURLINFO_OS_ERRNO returns 0; we don't know any more than this. - llwarns << "Failed to resolve hostname " << curlEasyRequest_w->getLowercaseHostname() << llendl; - dns_problem = true; - } - else if (mNothingReceivedYet) - { - // Only consider this to possibly be related to a DNS lookup if we didn't - // resolved the host yet, which can be detected by asking for - // CURLINFO_NAMELOOKUP_TIME which is set when libcurl initiates the - // actual connect and thus knows the IP# (possibly from it's DNS cache). - double namelookup_time; - curlEasyRequest_w->getinfo(CURLINFO_NAMELOOKUP_TIME, &namelookup_time); - dns_problem = (namelookup_time == 0); - } - if (dns_problem) - { - // Inform policy object that there might be problems with resolving this host. - // This will increase the connect timeout the next time we try to connect to this host. - AIHTTPTimeoutPolicy::connect_timed_out(curlEasyRequest_w->getLowercaseHostname()); - // AIFIXME: use return value to change priority - } - } - // Make sure no timeout will happen anymore. - mLowSpeedOn = false; - mStalled = (U64)-1; - DoutCurl("done: mStalled set to -1"); -} - -// Libcurl uses GetTickCount on windows, with a resolution of 10 to 16 ms. -// As a result, we can not assume that namelookup_time == 0 has a special meaning. -#define LOWRESTIMER LL_WINDOWS - -void HTTPTimeout::print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url) -{ - llwarns << "Request to \"" << curl_easy_request->getLowercaseHostname() << "\" timed out for " << curl_easy_request->getTimeoutPolicy()->name() << llendl; - llinfos << "Effective URL: \"" << eff_url << "\"." << llendl; - double namelookup_time, connect_time, appconnect_time, pretransfer_time, starttransfer_time; - curl_easy_request->getinfo(CURLINFO_NAMELOOKUP_TIME, &namelookup_time); - curl_easy_request->getinfo(CURLINFO_CONNECT_TIME, &connect_time); - curl_easy_request->getinfo(CURLINFO_APPCONNECT_TIME, &appconnect_time); - curl_easy_request->getinfo(CURLINFO_PRETRANSFER_TIME, &pretransfer_time); - curl_easy_request->getinfo(CURLINFO_STARTTRANSFER_TIME, &starttransfer_time); - if (namelookup_time == 0 -#if LOWRESTIMER - && connect_time == 0 -#endif - ) - { -#if LOWRESTIMER - llinfos << "Hostname seems to have been still in the DNS cache." << llendl; -#else - llwarns << "Curl returned CURLE_OPERATION_TIMEDOUT and DNS lookup did not occur according to timings. Apparently the resolve attempt timed out (bad network?)" << llendl; - llassert(connect_time == 0); - llassert(appconnect_time == 0); - llassert(pretransfer_time == 0); - llassert(starttransfer_time == 0); - return; -#endif - } - // If namelookup_time is less than 500 microseconds, then it's very likely just a DNS cache lookup. - else if (namelookup_time < 500e-6) - { -#if LOWRESTIMER - llinfos << "Hostname was most likely still in DNS cache (or lookup occured in under ~10ms)." << llendl; -#else - llinfos << "Hostname was still in DNS cache." << llendl; -#endif - } - else - { - llinfos << "DNS lookup of " << curl_easy_request->getLowercaseHostname() << " took " << namelookup_time << " seconds." << llendl; - } - if (connect_time == 0 -#if LOWRESTIMER - && namelookup_time > 0 // connect_time, when set, is namelookup_time + something. -#endif - ) - { - llwarns << "Curl returned CURLE_OPERATION_TIMEDOUT and connection did not occur according to timings: apparently the connect attempt timed out (bad network?)" << llendl; - llassert(appconnect_time == 0); - llassert(pretransfer_time == 0); - llassert(starttransfer_time == 0); - return; - } - // If connect_time is almost equal to namelookup_time, then it was just set because it was already connected. - if (connect_time - namelookup_time <= 1e-5) - { -#if LOWRESTIMER // Assuming 10ms resolution. - llinfos << "The socket was most likely already connected (or you connected to a proxy with a connect time of under ~10 ms)." << llendl; -#else - llinfos << "The socket was already connected (to remote or proxy)." << llendl; -#endif - // I'm assuming that the SSL/TLS handshake can be measured with a low res timer. - if (appconnect_time == 0) - { - llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl; - return; - } - // If appconnect_time is almost equal to connect_time, then it was just set because this is a connection re-use. - if (appconnect_time - connect_time <= 1e-5) - { - llinfos << "Connection with HTTP server was already established; this was a re-used connection." << llendl; - } - else - { - llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl; - } - } - else - { - llinfos << "Socket connected to remote host (or proxy) in " << (connect_time - namelookup_time) << " seconds." << llendl; - if (appconnect_time == 0) - { - llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl; - return; - } - llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl; - } - if (pretransfer_time == 0) - { - llwarns << "The transfer never happened because there was too much in the pipeline (apparently)." << llendl; - return; - } - else if (pretransfer_time - appconnect_time >= 1e-5) - { - llinfos << "Apparently there was a delay, due to waits in line for the pipeline, of " << (pretransfer_time - appconnect_time) << " seconds before the transfer began." << llendl; - } - if (starttransfer_time == 0) - { - llwarns << "No data was ever received from the server according to the timings." << llendl; - } - else - { - llinfos << "The time it took to send the request to the server plus the time it took before the server started to reply was " << (starttransfer_time - pretransfer_time) << " seconds." << llendl; - } - if (mNothingReceivedYet) - { - llinfos << "No data at all was actually received from the server." << llendl; - } - if (mUploadFinished) - { - llinfos << "The request upload finished successfully." << llendl; - } - if (mLastSecond > 0 && mLowSpeedOn) - { - llinfos << "The " << (mNothingReceivedYet ? "upload" : "download") << " did last " << mLastSecond << " second" << ((mLastSecond == 1) ? "" : "s") << ", before it timed out." << llendl; - } -} - } // namespace curlthread } // namespace AICurlPrivate @@ -2395,23 +2021,18 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size char const* const header_line = static_cast(data); size_t const header_len = size * nmemb; - if (self_w->httptimeout()->data_received(header_len)) // Update timeout administration. - { - // Transfer timed out. Return 0 which will abort with error CURLE_WRITE_ERROR. - return 0; - } if (!header_len) { return header_len; } std::string header(header_line, header_len); + bool done = false; if (!LLStringUtil::_isASCII(header)) { - return header_len; + done = true; } - // Per HTTP spec the first header line must be the status line. - if (header.substr(0, 5) == "HTTP/") + else if (header.substr(0, 5) == "HTTP/") { std::string::iterator const begin = header.begin(); std::string::iterator const end = header.end(); @@ -2445,6 +2066,16 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size } self_w->received_HTTP_header(); self_w->setStatusAndReason(status, reason); + done = true; + } + // Update timeout administration. This must be done after the status is already known. + if (self_w->httptimeout()->data_received(header_len/*,*/ ASSERT_ONLY_COMMA(self_w->upload_error_status()))) + { + // Transfer timed out. Return 0 which will abort with error CURLE_WRITE_ERROR. + return 0; + } + if (done) + { return header_len; } diff --git a/indra/llmessage/aihttptimeout.cpp b/indra/llmessage/aihttptimeout.cpp new file mode 100644 index 000000000..61ed5ca86 --- /dev/null +++ b/indra/llmessage/aihttptimeout.cpp @@ -0,0 +1,495 @@ +/** + * @file aihttptimeout.cpp + * @brief Implementation of HTTPTimeout + * + * Copyright (c) 2012, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 28/04/2012 + * Initial version, written by Aleric Inglewood @ SL + */ + +#ifndef HTTPTIMEOUT_TESTSUITE + +#include "linden_common.h" +#include "aihttptimeoutpolicy.h" +#include "lltimer.h" // calc_clock_frequency() +#include "aicurl.h" // DoutCurl + +#undef AICurlPrivate + +#else + +#include "../llcommon/stdtypes.h" +#include +#include + +#define llassert assert +#define llassert_always assert +#define DoutCurl(...) do { std::cout << __VA_ARGS__ ; } while(0) +#define Debug(...) do { } while(0) +#define llmin std::min +#define llwarns std::cout +#define llendl std::endl +int const CURLE_OPERATION_TIMEDOUT = 1; +int const CURLE_COULDNT_RESOLVE_HOST = 2; +int const CURLINFO_NAMELOOKUP_TIME = 3; + +F64 calc_clock_frequency(void) { return 1000000.0; } + +template +struct AIAccess { + T* mP; + AIAccess(T* p) : mP(p) { } + T* operator->() const { return mP; } +}; + +struct AIHTTPTimeoutPolicy { + U16 getReplyDelay(void) const { return 60; } + U16 getLowSpeedTime(void) const { return 30; } + U32 getLowSpeedLimit(void) const { return 56000; } + static bool connect_timed_out(std::string const&) { return false; } +}; + +namespace AICurlPrivate { + +class BufferedCurlEasyRequest { +public: + char const* getLowercaseHostname(void) const { return "hostname.com"; } + void getinfo(const int&, double* p) { *p = 0.1; } +}; + +} + +#endif // HTTPTIMEOUT_TESTSUITE + +#include "aihttptimeout.h" + +namespace AICurlPrivate { +namespace curlthread { + +//----------------------------------------------------------------------------- +// HTTPTimeout + +//static +F64 const HTTPTimeout::sClockWidth = 1.0 / calc_clock_frequency(); // Time between two clock ticks, in seconds. +U64 HTTPTimeout::sClockCount; // Clock count, set once per select() exit. + +// CURL-THREAD +// This is called when body data was sent to the server socket. +// <-----mLowSpeedOn------> +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ ^ ^ ^ ^ ^ +// | | | | | | +bool HTTPTimeout::data_sent(size_t n) +{ + // Generate events. + if (!mLowSpeedOn) + { + // If we can send data (for the first time) then that's our only way to know we connected. + reset_lowspeed(); + } + // Detect low speed. + return lowspeed(n); +} + +// CURL-THREAD +// This is called when the 'low speed' timer should be started. +// <-----mLowSpeedOn------> <-------mLowSpeedOn--------> +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ ^ +// | | +void HTTPTimeout::reset_lowspeed(void) +{ + mLowSpeedClock = sClockCount; + mLowSpeedOn = true; + mLastSecond = -1; // This causes lowspeed to initialize the rest. + mStalled = (U64)-1; // Stop reply delay timer. + DoutCurl("reset_lowspeed: mLowSpeedClock = " << mLowSpeedClock << "; mStalled = -1"); +} + +// CURL-THREAD +// This is called when everything we had to send to the server has been sent. +// <-----mLowSpeedOn------> +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ +// | +void HTTPTimeout::upload_finished(void) +{ + llassert(!mUploadFinished); // If we get here twice, then the 'upload finished' detection failed. + mUploadFinished = true; + // We finished uploading (if there was a body to upload at all), so not more transfer rate timeouts. + mLowSpeedOn = false; + // Timeout if the server doesn't reply quick enough. + mStalled = sClockCount + mPolicy->getReplyDelay() / sClockWidth; + DoutCurl("upload_finished: mStalled set to sClockCount (" << sClockCount << ") + " << (mStalled - sClockCount) << " (" << mPolicy->getReplyDelay() << " seconds)"); +} + +// CURL-THREAD +// This is called when data was received from the server. +// +// <--------------------------------mNothingReceivedYet------------------------------><-------mLowSpeedOn--------> +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ ^ ^ ^ ^ ^ ^ ^ +// | | | | | | | | +bool HTTPTimeout::data_received(size_t n/*,*/ +#ifdef CWDEBUG + ASSERT_ONLY_COMMA(bool upload_error_status) +#else + ASSERT_ONLY_COMMA(bool) +#endif + ) +{ + // The HTTP header of the reply is the first thing we receive. + if (mNothingReceivedYet && n > 0) + { + if (!mUploadFinished) + { + // mUploadFinished not being set this point should only happen for GET requests (in fact, then it is normal), + // because in that case it is impossible to detect the difference between connecting and waiting for a reply without + // using CURLOPT_DEBUGFUNCTION. Note that mDebugIsHeadOrGetMethod is only valid when the debug channel 'curlio' is on, + // because it is set in the debug callback function. + // This is also normal if we received a HTTP header with an error status, since that can interrupt our upload. + Debug(llassert(upload_error_status || AICurlEasyRequest_wat(*mLockObj)->mDebugIsHeadOrGetMethod || !dc::curlio.is_on())); + // 'Upload finished' detection failed, generate it now. + upload_finished(); + } + // Turn this flag off again now that we received data, so that if 'upload_finished()' is called again + // for a future upload on the same descriptor, then that won't trigger an assert. + // Note that because we also set mNothingReceivedYet here, we won't enter this code block anymore, + // so it's safe to do this. + mUploadFinished = false; + // Mark that something was received. + mNothingReceivedYet = false; + // We received something; switch to getLowSpeedLimit()/getLowSpeedTime(). + reset_lowspeed(); + } + return mLowSpeedOn ? lowspeed(n) : false; +} + +// CURL_THREAD +// bytes is the number of bytes we just sent or received (including headers). +// Returns true if the transfer should be aborted. +// +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ +// | | | | | | | | | | | | | | +bool HTTPTimeout::lowspeed(size_t bytes) +{ + //DoutCurlEntering("HTTPTimeout::lowspeed(" << bytes << ")"); commented out... too spammy for normal use. + + // The algorithm to determine if we timed out if different from how libcurls CURLOPT_LOW_SPEED_TIME works. + // + // libcurl determines the transfer rate since the last call to an equivalent 'lowspeed' function, and then + // triggers a timeout if CURLOPT_LOW_SPEED_TIME long such a transfer value is less than CURLOPT_LOW_SPEED_LIMIT. + // That doesn't work right because once there IS data it can happen that this function is called a few + // times (with less than a milisecond in between) causing seemingly VERY high "transfer rate" spikes. + // The only correct way to determine the transfer rate is to actually average over CURLOPT_LOW_SPEED_TIME + // seconds. + // + // We do this as follows: we create low_speed_time (in seconds) buckets and fill them with the number + // of bytes received during that second. We also keep track of the sum of all bytes received between 'now' + // and 'now - llmax(starttime, low_speed_time)'. Then if that period reaches at least low_speed_time + // seconds, and the transfer rate (sum / low_speed_time) is less than low_speed_limit, we abort. + + // When are we? + S32 second = (sClockCount - mLowSpeedClock) * sClockWidth; + llassert(sClockWidth > 0.0); + // This REALLY should never happen, but due to another bug it did happened + // and caused something so evil and hard to find that... NEVER AGAIN! + llassert(second >= 0); + + // If this is the same second as last time, just add the number of bytes to the current bucket. + if (second == mLastSecond) + { + mTotalBytes += bytes; + mBuckets[mBucket] += bytes; + return false; + } + + // We arrived at a new second. + // The below is at most executed once per second, even though for + // every currently connected transfer, CPU is not a big issue. + + // Determine the number of buckets needed and increase the number of buckets if needed. + U16 const low_speed_time = mPolicy->getLowSpeedTime(); + if (low_speed_time > mBuckets.size()) + { + mBuckets.resize(low_speed_time, 0); + } + + S32 s = mLastSecond; + mLastSecond = second; + + // If this is the first time this function is called, we need to do some initialization. + if (s == -1) + { + mBucket = 0; // It doesn't really matter where we start. + mTotalBytes = bytes; + mBuckets[mBucket] = bytes; + return false; + } + + // Update all administration. + U16 bucket = mBucket; + while(1) // Run over all the seconds that were skipped. + { + if (++bucket == low_speed_time) + bucket = 0; + if (++s == second) + break; + mTotalBytes -= mBuckets[bucket]; + mBuckets[bucket] = 0; + } + mBucket = bucket; + mTotalBytes -= mBuckets[mBucket]; + mTotalBytes += bytes; + mBuckets[mBucket] = bytes; + + // Check if we timed out. + U32 const low_speed_limit = mPolicy->getLowSpeedLimit(); + U32 mintotalbytes = low_speed_limit * low_speed_time; + DoutCurl("Transfered " << mTotalBytes << " bytes in " << llmin(second, (S32)low_speed_time) << " seconds after " << second << " second" << ((second == 1) ? "" : "s") << "."); + if (second >= low_speed_time) + { + DoutCurl("Average transfer rate is " << (mTotalBytes / low_speed_time) << " bytes/s (low speed limit is " << low_speed_limit << " bytes/s)"); + if (mTotalBytes < mintotalbytes) + { + // The average transfer rate over the passed low_speed_time seconds is too low. Abort the transfer. + llwarns << +#ifdef CWDEBUG + (void*)get_lockobj() << ": " +#endif + "aborting slow connection (average transfer rate below " << low_speed_limit << + " for more than " << low_speed_time << " second" << ((low_speed_time == 1) ? "" : "s") << ")." << llendl; + return true; + } + } + + // Calculate how long the data transfer may stall until we should timeout. + llassert_always(mintotalbytes > 0); + S32 max_stall_time = 0; + U32 dropped_bytes = 0; + while(1) + { + if (++bucket == low_speed_time) // The next second the next bucket will be emptied. + bucket = 0; + ++max_stall_time; + dropped_bytes += mBuckets[bucket]; + // Note how, when max_stall_time == low_speed_time, dropped_bytes has + // to be equal to mTotalBytes, the sum of all vector elements. + llassert(max_stall_time < low_speed_time || dropped_bytes == mTotalBytes); + // AIFIXME: This is a bug and should really be fixed instead of just be a warning. + if (!(max_stall_time < low_speed_time || dropped_bytes == mTotalBytes)) + { + llwarns << "ASSERT max_stall_time < low_speed_time || dropped_bytes == mTotalBytes failed... aborting. " + "max_stall_time = " << max_stall_time << "; low_speed_time = " << low_speed_time << + "; dropped_bytes = " << dropped_bytes << "; mTotalBytes = " << mTotalBytes << llendl; + break; + } + // And thus the following will certainly abort. + if (second + max_stall_time >= low_speed_time && mTotalBytes - dropped_bytes < mintotalbytes) + break; + } + // If this function isn't called again within max_stall_time seconds, we stalled. + mStalled = sClockCount + max_stall_time / sClockWidth; + DoutCurl("mStalled set to sClockCount (" << sClockCount << ") + " << (mStalled - sClockCount) << " (" << max_stall_time << " seconds)"); + + return false; +} + +// CURL-THREAD +// This is called immediately before done() after curl finished, with code. +// <-------mLowSpeedOn--------> +// queued--><--DNS lookup + connect + send headers-->[<--send body (if any)-->]<--replydelay--><--receive headers + body--><--done +// ^ +// | +void HTTPTimeout::done(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode code) +{ + if (code == CURLE_OPERATION_TIMEDOUT || code == CURLE_COULDNT_RESOLVE_HOST) + { + bool dns_problem = false; + if (code == CURLE_COULDNT_RESOLVE_HOST) + { + // Note that CURLINFO_OS_ERRNO returns 0; we don't know any more than this. + llwarns << "Failed to resolve hostname " << curlEasyRequest_w->getLowercaseHostname() << llendl; + dns_problem = true; + } + else if (mNothingReceivedYet) + { + // Only consider this to possibly be related to a DNS lookup if we didn't + // resolved the host yet, which can be detected by asking for + // CURLINFO_NAMELOOKUP_TIME which is set when libcurl initiates the + // actual connect and thus knows the IP# (possibly from it's DNS cache). + double namelookup_time; + curlEasyRequest_w->getinfo(CURLINFO_NAMELOOKUP_TIME, &namelookup_time); + dns_problem = (namelookup_time == 0); + } + if (dns_problem) + { + // Inform policy object that there might be problems with resolving this host. + // This will increase the connect timeout the next time we try to connect to this host. + AIHTTPTimeoutPolicy::connect_timed_out(curlEasyRequest_w->getLowercaseHostname()); + // AIFIXME: use return value to change priority + } + } + // Make sure no timeout will happen anymore. + mLowSpeedOn = false; + mStalled = (U64)-1; + DoutCurl("done: mStalled set to -1"); +} + +// Libcurl uses GetTickCount on windows, with a resolution of 10 to 16 ms. +// As a result, we can not assume that namelookup_time == 0 has a special meaning. +#define LOWRESTIMER LL_WINDOWS + +void HTTPTimeout::print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url) +{ +#ifndef HTTPTIMEOUT_TESTSUITE + llwarns << "Request to \"" << curl_easy_request->getLowercaseHostname() << "\" timed out for " << curl_easy_request->getTimeoutPolicy()->name() << llendl; + llinfos << "Effective URL: \"" << eff_url << "\"." << llendl; + double namelookup_time, connect_time, appconnect_time, pretransfer_time, starttransfer_time; + curl_easy_request->getinfo(CURLINFO_NAMELOOKUP_TIME, &namelookup_time); + curl_easy_request->getinfo(CURLINFO_CONNECT_TIME, &connect_time); + curl_easy_request->getinfo(CURLINFO_APPCONNECT_TIME, &appconnect_time); + curl_easy_request->getinfo(CURLINFO_PRETRANSFER_TIME, &pretransfer_time); + curl_easy_request->getinfo(CURLINFO_STARTTRANSFER_TIME, &starttransfer_time); + if (namelookup_time == 0 +#if LOWRESTIMER + && connect_time == 0 +#endif + ) + { +#if LOWRESTIMER + llinfos << "Hostname seems to have been still in the DNS cache." << llendl; +#else + llwarns << "Curl returned CURLE_OPERATION_TIMEDOUT and DNS lookup did not occur according to timings. Apparently the resolve attempt timed out (bad network?)" << llendl; + llassert(connect_time == 0); + llassert(appconnect_time == 0); + llassert(pretransfer_time == 0); + llassert(starttransfer_time == 0); + return; +#endif + } + // If namelookup_time is less than 500 microseconds, then it's very likely just a DNS cache lookup. + else if (namelookup_time < 500e-6) + { +#if LOWRESTIMER + llinfos << "Hostname was most likely still in DNS cache (or lookup occured in under ~10ms)." << llendl; +#else + llinfos << "Hostname was still in DNS cache." << llendl; +#endif + } + else + { + llinfos << "DNS lookup of " << curl_easy_request->getLowercaseHostname() << " took " << namelookup_time << " seconds." << llendl; + } + if (connect_time == 0 +#if LOWRESTIMER + && namelookup_time > 0 // connect_time, when set, is namelookup_time + something. +#endif + ) + { + llwarns << "Curl returned CURLE_OPERATION_TIMEDOUT and connection did not occur according to timings: apparently the connect attempt timed out (bad network?)" << llendl; + llassert(appconnect_time == 0); + llassert(pretransfer_time == 0); + llassert(starttransfer_time == 0); + return; + } + // If connect_time is almost equal to namelookup_time, then it was just set because it was already connected. + if (connect_time - namelookup_time <= 1e-5) + { +#if LOWRESTIMER // Assuming 10ms resolution. + llinfos << "The socket was most likely already connected (or you connected to a proxy with a connect time of under ~10 ms)." << llendl; +#else + llinfos << "The socket was already connected (to remote or proxy)." << llendl; +#endif + // I'm assuming that the SSL/TLS handshake can be measured with a low res timer. + if (appconnect_time == 0) + { + llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl; + return; + } + // If appconnect_time is almost equal to connect_time, then it was just set because this is a connection re-use. + if (appconnect_time - connect_time <= 1e-5) + { + llinfos << "Connection with HTTP server was already established; this was a re-used connection." << llendl; + } + else + { + llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl; + } + } + else + { + llinfos << "Socket connected to remote host (or proxy) in " << (connect_time - namelookup_time) << " seconds." << llendl; + if (appconnect_time == 0) + { + llwarns << "The SSL/TLS handshake never occurred according to the timings!" << llendl; + return; + } + llinfos << "SSL/TLS handshake with HTTP server took " << (appconnect_time - connect_time) << " seconds." << llendl; + } + if (pretransfer_time == 0) + { + llwarns << "The transfer never happened because there was too much in the pipeline (apparently)." << llendl; + return; + } + else if (pretransfer_time - appconnect_time >= 1e-5) + { + llinfos << "Apparently there was a delay, due to waits in line for the pipeline, of " << (pretransfer_time - appconnect_time) << " seconds before the transfer began." << llendl; + } + if (starttransfer_time == 0) + { + llwarns << "No data was ever received from the server according to the timings." << llendl; + } + else + { + llinfos << "The time it took to send the request to the server plus the time it took before the server started to reply was " << (starttransfer_time - pretransfer_time) << " seconds." << llendl; + } + if (mNothingReceivedYet) + { + llinfos << "No data at all was actually received from the server." << llendl; + } + if (mUploadFinished) + { + llinfos << "The request upload finished successfully." << llendl; + } + if (mLastSecond > 0 && mLowSpeedOn) + { + llinfos << "The " << (mNothingReceivedYet ? "upload" : "download") << " did last " << mLastSecond << " second" << ((mLastSecond == 1) ? "" : "s") << ", before it timed out." << llendl; + } +#endif // HTTPTIMEOUT_TESTSUITE +} + +} // namespace curlthread +} // namespace AICurlPrivate + +#ifdef HTTPTIMEOUT_TESTSUITE +int main() +{ + using namespace AICurlPrivate::curlthread; + AIHTTPTimeoutPolicy policy; + HTTPTimeout test(&policy, NULL); +} +#endif // HTTPTIMEOUT_TESTSUITE + diff --git a/indra/llmessage/aihttptimeout.h b/indra/llmessage/aihttptimeout.h new file mode 100644 index 000000000..6bb89ee20 --- /dev/null +++ b/indra/llmessage/aihttptimeout.h @@ -0,0 +1,136 @@ +/** + * @file aihttptimeout.h + * @brief HTTP timeout control class. + * + * Copyright (c) 2012, Aleric Inglewood. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution. + * + * CHANGELOG + * and additional copyright holders. + * + * 28/04/2012 + * Initial version, written by Aleric Inglewood @ SL + */ + +#ifndef AIHTTPTIMEOUT_H +#define AIHTTPTIMEOUT_H + +#include + +#ifndef HTTPTIMEOUT_TESTSUITE + +#include "llrefcount.h" +#include "aithreadsafe.h" // AIAccess + +#include // Needed for files that include this header (also for aicurlprivate.h). +#ifdef DEBUG_CURLIO +#include "debug_libcurl.h" +#endif + +#else + +#include + +class LLRefCount { }; +template struct AIAccess; +typedef int CURLcode; + +#define ASSERT_ONLY_COMMA(...) , __VA_ARGS__ + +#endif + +class AIHTTPTimeoutPolicy; + +// Forward declaration (see aicurlprivate.h). +namespace AICurlPrivate { + class BufferedCurlEasyRequest; +} // namespace AICurlPrivate + +typedef AIAccess AICurlEasyRequest_wat; + +namespace AICurlPrivate { + +class CurlEasyRequest; +class ThreadSafeBufferedCurlEasyRequest; + +namespace curlthread { + +// A class that keeps track of timeout administration per connection. +class HTTPTimeout : public LLRefCount { + private: + AIHTTPTimeoutPolicy const* mPolicy; // A pointer to the used timeout policy. + std::vector mBuckets; // An array with the number of bytes transfered in each second. + U16 mBucket; // The bucket corresponding to mLastSecond. + bool mNothingReceivedYet; // Set when created, reset when the HTML reply header from the server is received. + bool mLowSpeedOn; // Set while uploading or downloading data. + bool mUploadFinished; // Used to keep track of whether upload_finished was called yet. + S32 mLastSecond; // The time at which lowspeed() was last called, in seconds since mLowSpeedClock. + U32 mTotalBytes; // The sum of all bytes in mBuckets. + U64 mLowSpeedClock; // Clock count at which low speed detection (re)started. + U64 mStalled; // The clock count at which this transaction is considered to be stalling if nothing is transfered anymore. + public: + static F64 const sClockWidth; // Time between two clock ticks in seconds. + static U64 sClockCount; // Clock count used as 'now' during one loop of the main loop. +#if defined(CWDEBUG) || defined(DEBUG_CURLIO) + ThreadSafeBufferedCurlEasyRequest* mLockObj; +#endif + + public: + HTTPTimeout(AIHTTPTimeoutPolicy const* policy, ThreadSafeBufferedCurlEasyRequest* lock_obj) : + mPolicy(policy), mNothingReceivedYet(true), mLowSpeedOn(false), mUploadFinished(false), mStalled((U64)-1) +#if defined(CWDEBUG) || defined(DEBUG_CURLIO) + , mLockObj(lock_obj) +#endif + { } + + // Called when everything we had to send to the server has been sent. + void upload_finished(void); + + // Called when data is sent. Returns true if transfer timed out. + bool data_sent(size_t n); + + // Called when data is received. Returns true if transfer timed out. + bool data_received(size_t n/*,*/ ASSERT_ONLY_COMMA(bool upload_error_status = false)); + + // Called immediately before done() after curl finished, with code. + void done(AICurlEasyRequest_wat const& curlEasyRequest_w, CURLcode code); + + // Accessor. + bool has_stalled(void) const { return mStalled < sClockCount; } + + // Called from BufferedCurlEasyRequest::processOutput if a timeout occurred. + void print_diagnostics(CurlEasyRequest const* curl_easy_request, char const* eff_url); + +#if defined(CWDEBUG) || defined(DEBUG_CURLIO) + void* get_lockobj(void) const { return mLockObj; } +#endif + + private: + // (Re)start low speed transer rate detection. + void reset_lowspeed(void); + + // Common low speed detection, Called from data_sent or data_received. + bool lowspeed(size_t bytes); +}; + +} // namespace curlthread +} // namespace AICurlPrivate + +#endif + diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 48b6e4f63..36d691a5d 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -188,8 +188,6 @@ private: virtual bool needsHeaders(void) const { return true; } public: - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarNameResponder_timeout; } - LLAvatarNameResponder(const std::vector& agent_ids) : mAgentIDs(agent_ids) { } @@ -271,6 +269,9 @@ public: LLAvatarNameCache::handleAgentError(agent_id); } } + + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarNameResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLAvatarNameResponder"; } }; // Provide some fallback for agents that return errors diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 4021850a5..4acac78f3 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -370,12 +370,14 @@ void LLHTTPClient::ResponderBase::decode_raw_body(U32 status, std::string const& std::string const& LLHTTPClient::ResponderBase::get_cookie(std::string const& key) { AIHTTPReceivedHeaders::range_type cookies; - mReceivedHeaders.getValues("set-cookie", cookies); - for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie) + if (mReceivedHeaders.getValues("set-cookie", cookies)) { - if (key == cookie->second.substr(0, cookie->second.find('='))) + for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie) { - return cookie->second; + if (key == cookie->second.substr(0, cookie->second.find('='))) + { + return cookie->second; + } } } // Not found. @@ -533,16 +535,19 @@ protected: class BlockingLLSDPostResponder : public BlockingLLSDResponder { public: /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDPost_timeout; } + /*virtual*/ char const* getName(void) const { return "BlockingLLSDPostResponder"; } }; class BlockingLLSDGetResponder : public BlockingLLSDResponder { public: /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDGet_timeout; } + /*virtual*/ char const* getName(void) const { return "BlockingLLSDGetResponder"; } }; class BlockingRawGetResponder : public BlockingRawResponder { public: /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingRawGet_timeout; } + /*virtual*/ char const* getName(void) const { return "BlockingRawGetResponder"; } }; // End (blocking) responders. diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 934d5b137..055802a60 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -158,10 +158,12 @@ public: // Erase all headers EXCEPT the cookies. AIHTTPReceivedHeaders set_cookie_headers; AIHTTPReceivedHeaders::range_type cookies; - mReceivedHeaders.getValues("set-cookie", cookies); - for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie) + if (mReceivedHeaders.getValues("set-cookie", cookies)) { - set_cookie_headers.addHeader(cookie->first, cookie->second); + for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie) + { + set_cookie_headers.addHeader(cookie->first, cookie->second); + } } // Replace headers with just the cookie headers. mReceivedHeaders.swap(set_cookie_headers); @@ -196,6 +198,9 @@ public: // Timeout policy to use. virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const = 0; + // The name of the derived responder object. For debugging purposes. + virtual char const* getName(void) const = 0; + protected: // Derived classes can override this to get the HTML headers that were received, when the message is completed. // Only actually called for classes that implement a needsHeaders() that returns true. @@ -378,6 +383,7 @@ public: */ class ResponderIgnore : public ResponderIgnoreBody { /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return responderIgnore_timeout;} + /*virtual*/ char const* getName(void) const { return "ResponderIgnore"; } }; // A Responder is passed around as ResponderPtr, which causes it to automatically diff --git a/indra/llmessage/llsdmessage.h b/indra/llmessage/llsdmessage.h index 72b7dc675..6e7530ddb 100644 --- a/indra/llmessage/llsdmessage.h +++ b/indra/llmessage/llsdmessage.h @@ -136,8 +136,6 @@ private: class EventResponder: public LLHTTPClient::ResponderWithResult { public: - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return *mHTTPTimeoutPolicy; } - /** * LLHTTPClient::ResponderWithResult that dispatches via named LLEventPump instances. * We bind LLEventPumps, even though it's an LLSingleton, for testability. @@ -158,9 +156,12 @@ private: void setTimeoutPolicy(std::string const& name); - virtual void result(const LLSD& data); - virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); - + /*virtual*/ void result(const LLSD& data); + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content); + + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return *mHTTPTimeoutPolicy; } + /*virtual*/ char const* getName(void) const { return "EventResponder"; } + private: LLEventPumps& mPumps; LLReqID mReqID; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 1d51ff800..3f9c95dc8 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -118,7 +118,7 @@ namespace { } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { // don't spam when agent communication disconnected already if (status != 410) @@ -131,12 +131,13 @@ namespace if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT); } - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_NOERR); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fnPtrResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fnPtrResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLFnPtrResponder"; } private: diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 5c715d3ff..b193c22b2 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -316,7 +316,8 @@ void LLRadioGroup::setValue( const LLSD& value ) } else { - llwarns << "LLRadioGroup::setValue: value not found: " << value_name << llendl; + llwarns << "LLRadioGroup::setValue: radio_item with name=\"" << value_name << "\" not found, radio_group values are set by radio_item name not value. Falling back on LLUICtrl::setValue." << llendl; + LLUICtrl::setValue(value); } } } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index ae81cce24..07f99132b 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1185,7 +1185,7 @@ void LLView::drawChildren() { // Only draw views that are within the root view LLRect screen_rect = viewp->calcScreenRect(); - if ( rootp->getLocalRect().overlaps(screen_rect) ) + if ( rootp->getRect().overlaps(screen_rect) ) { //gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ca7cc1672..a3e3743f2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -781,7 +781,29 @@ Found in Advanced->Rendering->Info Displays Boolean Value 0 - ConciseIMButtons + + UseConciseGroupChatButtons + + Comment + Whether or not group chats use buttons concisely on the same line as the group name, changes apply to new group chats only. + Persist + 1 + Type + Boolean + Value + 0 + + UseConciseConferenceButtons + + Comment + Whether or not conferences use buttons concisely on the same line as the name of the conference, changes apply to new conferences only. + Persist + 1 + Type + Boolean + Value + 0 + ShowLocalChatFloaterBar Comment diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index 467d0b40b..dd8531965 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -378,6 +378,8 @@ void LLPrefsAscentChat::refreshValues() mShowLocalChatFloaterBar = gSavedSettings.getBOOL("ShowLocalChatFloaterBar"); mHorizButt = gSavedSettings.getBOOL("ContactsUseHorizontalButtons"); mOneLineIMButt = gSavedSettings.getBOOL("UseConciseIMButtons"); + mOneLineGroupButt = gSavedSettings.getBOOL("UseConciseGroupChatButtons"); + mOneLineConfButt = gSavedSettings.getBOOL("UseConciseConferenceButtons"); mOnlyComm = gSavedSettings.getBOOL("CommunicateSpecificShortcut"); //Spam -------------------------------------------------------------------------------- @@ -604,6 +606,8 @@ void LLPrefsAscentChat::cancel() gSavedSettings.setBOOL("ShowLocalChatFloaterBar", mShowLocalChatFloaterBar); gSavedSettings.setBOOL("ContactsUseHorizontalButtons", mHorizButt); gSavedSettings.setBOOL("UseConciseIMButtons", mOneLineIMButt); + gSavedSettings.setBOOL("UseConciseGroupChatButtons", mOneLineGroupButt); + gSavedSettings.setBOOL("UseConciseConferenceButtons", mOneLineConfButt); gSavedSettings.setBOOL("CommunicateSpecificShortcut", mOnlyComm); //Spam -------------------------------------------------------------------------------- diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index d66297848..63cedf611 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -92,6 +92,8 @@ protected: bool mShowLocalChatFloaterBar; bool mHorizButt; bool mOneLineIMButt; + bool mOneLineGroupButt; + bool mOneLineConfButt; bool mOnlyComm; //Spam -------------------------------------------------------------------------------- diff --git a/indra/newview/floatervoicelicense.cpp b/indra/newview/floatervoicelicense.cpp index 322c4778e..17dff4a5e 100644 --- a/indra/newview/floatervoicelicense.cpp +++ b/indra/newview/floatervoicelicense.cpp @@ -85,13 +85,13 @@ class LLIamHereVoice : public LLHTTPClient::ResponderWithResult mParent = parentIn; }; - virtual void result( const LLSD& content ) + /*virtual*/ void result( const LLSD& content ) { if ( mParent ) mParent->setSiteIsAlive( true ); }; - virtual void error( U32 status, const std::string& reason ) + /*virtual*/ void error( U32 status, const std::string& reason ) { if ( mParent ) { @@ -103,7 +103,8 @@ class LLIamHereVoice : public LLHTTPClient::ResponderWithResult } }; - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHereVoice_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHereVoice_timeout; } + /*virtual*/ char const* getName(void) const { return "LLIamHereVoice"; } }; // this is global and not a class member to keep crud out of the header file diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index ce2e6bb1e..674ea6143 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -301,7 +301,9 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) break;*/ } } -/*struct InventoryImportInfo + +#if 0 +struct InventoryImportInfo { U32 localid; LLAssetType::EType type; @@ -372,7 +374,7 @@ public: { } - virtual void uploadComplete(const LLSD& content) + /*virtual*/ void uploadComplete(const LLSD& content) { LLPointer cb = new JCImportTransferCallback(data); LLPermissions perm; @@ -385,6 +387,7 @@ public: cb); } + /*virtual*/ char const* getName(void) const { return "JCImportInventoryResponder"; } private: InventoryImportInfo* data; }; @@ -405,13 +408,14 @@ public: LLAssetType::EType asset_type) : LLAssetUploadResponder(post_data, file_name, asset_type) { } - virtual void uploadComplete(const LLSD& content) + /*virtual*/ void uploadComplete(const LLSD& content) { //cmdline_printchat("completed upload, inserting"); LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id); LLViewerObject* objectp = find(data->localid); insert(item, objectp, data); } + /*virtual*/ char const* getName(void) const { return "JCPostInvUploadResponder"; } private: LLUUID item_id; InventoryImportInfo* data; @@ -1119,4 +1123,4 @@ void ImportTracker::plywood_above_head() msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); msg->sendReliable(region->getHost()); } -*/ +#endif diff --git a/indra/newview/lggdicdownload.cpp b/indra/newview/lggdicdownload.cpp index d4caa10ae..8207ed0bc 100644 --- a/indra/newview/lggdicdownload.cpp +++ b/indra/newview/lggdicdownload.cpp @@ -57,12 +57,13 @@ class EmeraldDicDownloader : public LLHTTPClient::ResponderWithCompleted public: EmeraldDicDownloader(lggDicDownloadFloater* spanel, std::string sname); ~EmeraldDicDownloader() { } - void completedRaw( + /*virtual*/ void completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, const buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return emeraldDicDownloader_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return emeraldDicDownloader_timeout; } + /*virtual*/ char const* getName(void) const { return "EmeraldDicDownloader"; } private: lggDicDownloadFloater* panel; std::string name; diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index a319e38d7..d4a5108c5 100644 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -54,13 +54,13 @@ public: } } - void error( U32 statusNum, const std::string& reason ) + /*virtual*/ void error( U32 statusNum, const std::string& reason ) { llwarns << "Transport error "<get(); @@ -136,13 +136,14 @@ public: LLUpdateTaskInventoryResponder::uploadComplete(content); } + /*virtual*/ char const* getName(void) const { return "LLAssetUploadChainResponder"; } + LLAssetUploadQueueSupplier *mSupplier; char* mData; U32 mDataSize; std::string mScriptName; }; - LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) : mSupplier(supplier) { diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 173666a12..642b0f307 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -317,8 +317,10 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content) LLNewAgentInventoryResponder::LLNewAgentInventoryResponder( const LLSD& post_data, const LLUUID& vfile_id, - LLAssetType::EType asset_type) - : LLAssetUploadResponder(post_data, vfile_id, asset_type) + LLAssetType::EType asset_type, + void (*callback)(bool, void*), + void* user_data) + : LLAssetUploadResponder(post_data, vfile_id, asset_type), mCallBack(callback), mUserData(user_data) { } @@ -326,13 +328,17 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder( const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type) - : LLAssetUploadResponder(post_data, file_name, asset_type) + : LLAssetUploadResponder(post_data, file_name, asset_type), mCallBack(NULL), mUserData(NULL) { } // virtual void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reason) { + if (mCallBack) + { + (*mCallBack)(false, mUserData); + } LLAssetUploadResponder::error(statusNum, reason); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE); } @@ -340,6 +346,10 @@ void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reaso //virtual void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content) { + if (mCallBack) + { + (*mCallBack)(false, mUserData); + } LLAssetUploadResponder::uploadFailure(content); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE); } @@ -349,6 +359,11 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; + if (mCallBack) + { + (*mCallBack)(true, mUserData); + } + //std::ostringstream llsdxml; //LLSDSerialize::toXML(content, llsdxml); //llinfos << "upload complete content:\n " << llsdxml.str() << llendl; diff --git a/indra/newview/llassetuploadresponders.h b/indra/newview/llassetuploadresponders.h index fa4e5a8eb..bdcf41390 100644 --- a/indra/newview/llassetuploadresponders.h +++ b/indra/newview/llassetuploadresponders.h @@ -61,9 +61,10 @@ public: const std::string& file_name, LLAssetType::EType asset_type); ~LLAssetUploadResponder(); - virtual void error(U32 statusNum, const std::string& reason); - virtual void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return assetUploadResponder_timeout; } + /*virtual*/ void error(U32 statusNum, const std::string& reason); + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return assetUploadResponder_timeout; } + virtual void uploadUpload(const LLSD& content); virtual void uploadComplete(const LLSD& content); virtual void uploadFailure(const LLSD& content); @@ -77,18 +78,23 @@ protected: class LLNewAgentInventoryResponder : public LLAssetUploadResponder { + void (*mCallBack)(bool, void*); + void* mUserData; public: LLNewAgentInventoryResponder( const LLSD& post_data, const LLUUID& vfile_id, - LLAssetType::EType asset_type); + LLAssetType::EType asset_type, + void (*callback)(bool, void*) = NULL, + void* user_data = NULL); LLNewAgentInventoryResponder( const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type); - virtual void error(U32 statusNum, const std::string& reason); + /*virtual*/ void error(U32 statusNum, const std::string& reason); virtual void uploadComplete(const LLSD& content); virtual void uploadFailure(const LLSD& content); + /*virtual*/ char const* getName(void) const { return "LLNewAgentInventoryResponder"; } }; // A base class which goes through and performs some default @@ -110,12 +116,12 @@ public: const LLSD& inventory_info); virtual ~LLNewAgentInventoryVariablePriceResponder(); - void errorWithContent( + /*virtual*/ void errorWithContent( U32 statusNum, const std::string& reason, const LLSD& content); - void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return newAgentInventoryVariablePriceResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return newAgentInventoryVariablePriceResponder_timeout; } virtual void onApplicationLevelError( const LLSD& error); @@ -141,8 +147,9 @@ public: ~LLSendTexLayerResponder(); - virtual void uploadComplete(const LLSD& content); - virtual void error(U32 statusNum, const std::string& reason); + /*virtual*/ void uploadComplete(const LLSD& content); + /*virtual*/ void error(U32 statusNum, const std::string& reason); + /*virtual*/ char const* getName(void) const { return "LLSendTexLayerResponder"; } LLBakedUploadData * mBakedUploadData; }; @@ -157,6 +164,7 @@ public: const std::string& file_name, LLAssetType::EType asset_type); virtual void uploadComplete(const LLSD& content); + /*virtual*/ char const* getName(void) const { return "LLUpdateAgentInventoryResponder"; } }; class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder @@ -174,7 +182,8 @@ public: LLAssetType::EType asset_type); virtual void uploadComplete(const LLSD& content); - + /*virtual*/ char const* getName(void) const { return "LLUpdateTaskInventoryResponder"; } + private: LLUUID mQueueId; }; diff --git a/indra/newview/llclassifiedstatsresponder.h b/indra/newview/llclassifiedstatsresponder.h index f317d5851..d44d43f78 100644 --- a/indra/newview/llclassifiedstatsresponder.h +++ b/indra/newview/llclassifiedstatsresponder.h @@ -45,10 +45,11 @@ class LLClassifiedStatsResponder : public LLHTTPClient::ResponderWithResult public: LLClassifiedStatsResponder(LLHandle classified_panel_handle, LLUUID classified_id); //If we get back a normal response, handle it here - virtual void result(const LLSD& content); + /*virtual*/ void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return classifiedStatsResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return classifiedStatsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLClassifiedStatsResponder"; } protected: LLHandle mClassifiedPanelHandle; diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 6548d520b..3efc942da 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -73,9 +73,10 @@ namespace void handleMessage(const LLSD& content); - virtual void error(U32 status, const std::string& reason); - virtual void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return eventPollResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return eventPollResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLEventPollResponder"; } private: diff --git a/indra/newview/llfloateractivespeakers.cpp b/indra/newview/llfloateractivespeakers.cpp index 5eb9afa32..26cdb0752 100644 --- a/indra/newview/llfloateractivespeakers.cpp +++ b/indra/newview/llfloateractivespeakers.cpp @@ -832,7 +832,7 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data mSessionID = session_id; } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llwarns << status << ": " << reason << llendl; @@ -862,7 +862,8 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return muteVoiceResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return muteVoiceResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "MuteVoiceResponder"; } private: LLUUID mSessionID; @@ -899,7 +900,7 @@ void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) mSessionID = session_id; } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llwarns << status << ": " << reason << llendl; @@ -929,7 +930,8 @@ void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data) } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return muteTextResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return muteTextResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "MuteTextResponder"; } private: LLUUID mSessionID; @@ -967,11 +969,12 @@ void LLPanelActiveSpeakers::onChangeModerationMode(LLUICtrl* ctrl, void* user_da struct ModerationModeResponder : public LLHTTPClient::ResponderIgnoreBody { - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llwarns << status << ": " << reason << llendl; } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return moderationModeResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return moderationModeResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "ModerationModeResponder"; } }; LLHTTPClient::post(url, data, new ModerationModeResponder()); diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index dc0ad358c..f0593517f 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -487,7 +487,8 @@ public: } } - const AIHTTPTimeoutPolicy &getHTTPTimeoutPolicy(void) const { return avatarPickerResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarPickerResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLAvatarPickerResponder"; } }; void LLFloaterAvatarPicker::find() diff --git a/indra/newview/llfloaterfeed.cpp b/indra/newview/llfloaterfeed.cpp index 0fb31467e..44aa7ed67 100644 --- a/indra/newview/llfloaterfeed.cpp +++ b/indra/newview/llfloaterfeed.cpp @@ -43,6 +43,7 @@ #include "llviewerwindow.h" #include "llwebprofile.h" #include "lluploaddialog.h" +#include "lltexteditor.h" #include @@ -52,7 +53,7 @@ LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) : LLFloater(std::string("Feed Floater")), - mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index) + mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index), mHasFirstMsgFocus(false) { } @@ -66,10 +67,26 @@ BOOL LLFloaterFeed::postBuild() { getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this)); getChild("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this)); + LLTextEditor* caption = getChild("caption"); + if (caption) + { + // For the first time a user focusess to the msg box, all text will be selected. + caption->setFocusChangedCallback(boost::bind(&LLFloaterFeed::onMsgFormFocusRecieved, this, _1, caption)); + } + childSetFocus("cancel_btn", TRUE); return true; } +void LLFloaterFeed::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption) +{ + if (caption && caption == receiver && caption->hasFocus() && !mHasFirstMsgFocus) + { + mHasFirstMsgFocus = true; + caption->setText(LLStringUtil::null); + } +} + // static LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, int index) { @@ -148,6 +165,12 @@ void LLFloaterFeed::onClose(bool app_quitting) void LLFloaterFeed::onClickPost() { + if (!mHasFirstMsgFocus) + { + // The user never switched focus to the messagee window. + // Using the default string. + childSetValue("caption", getString("default_message")); + } if (mPNGImage.notNull()) { static LLCachedControl add_location("SnapshotFeedAddLocation"); diff --git a/indra/newview/llfloaterfeed.h b/indra/newview/llfloaterfeed.h index a204906ba..8db4f3c79 100644 --- a/indra/newview/llfloaterfeed.h +++ b/indra/newview/llfloaterfeed.h @@ -38,6 +38,8 @@ class LLImagePNG; class LLViewerTexture; +class LLFocusableElement; +class LLTextEditor; class LLFloaterFeed : public LLFloater { @@ -53,12 +55,14 @@ public: void onClickCancel(); void onClickPost(); + void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption); protected: LLPointer mPNGImage; LLPointer mViewerImage; LLVector2 const mImageScale; int mSnapshotIndex; + bool mHasFirstMsgFocus; }; #endif // LL_LLFLOATERFEED_H diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 6c05f60a5..16321763a 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -251,7 +251,6 @@ public: /*virtual*/ void uploadComplete(const LLSD& content) { // we don't care about what the server returns from this post, just clean up the UI - LLUploadDialog::modalUploadFinished(); LLFloaterSnapshot::savePostcardDone(true, mSnapshotIndex); } /*virtual*/ void uploadFailure(const LLSD& content) @@ -264,6 +263,7 @@ public: LLAssetUploadResponder::error(statusNum, reason); LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex); } + /*virtual*/ char const* getName(void) const { return "LLSendPostcardResponder"; } }; // static @@ -313,8 +313,6 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, { LLFloaterPostcard *self = (LLFloaterPostcard *)user_data; - LLUploadDialog::modalUploadFinished(); - LLFloaterSnapshot::savePostcardDone(!result, self->mSnapshotIndex); if (result) @@ -345,7 +343,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, gAgent.sendReliableMessage(); } - self->close(); + self->destroy(); } // static diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index a17eeab1e..f19392fab 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -80,12 +80,9 @@ namespace class AsyncConsoleResponder : public LLHTTPClient::ResponderIgnoreBody { public: - /* virtual */ - void error(U32 status, const std::string& reason) - { - sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); - } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason) { sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "AsyncConsoleResponder"; } }; class ConsoleResponder : public LLHTTPClient::ResponderWithResult @@ -95,8 +92,7 @@ namespace { } - /*virtual*/ - void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { if (mOutput) { @@ -106,8 +102,7 @@ namespace } } - /*virtual*/ - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if (mOutput) { @@ -116,7 +111,8 @@ namespace } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return consoleResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return consoleResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "ConsoleResponder"; } LLTextEditor * mOutput; }; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index bc6dbbde0..2265d6671 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2326,7 +2326,7 @@ public: } // if we get a normal response, handle it here - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { LL_INFOS("Windlight") << "Successfully committed estate info" << llendl; @@ -2337,13 +2337,14 @@ public: } // if we get an error response - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llinfos << "LLEstateChangeInfoResponder::error " << status << ": " << reason << llendl; } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return estateChangeInfoResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return estateChangeInfoResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLEstateChangeInfoResponder"; } private: LLHandle mpPanel; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index db29806ac..03c5bc20f 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -843,7 +843,7 @@ public: LLUserReportScreenshotResponder(const LLSD & post_data, const LLUUID & vfile_id, LLAssetType::EType asset_type): - LLAssetUploadResponder(post_data, vfile_id, asset_type) + LLAssetUploadResponder(post_data, vfile_id, asset_type) { } void uploadFailed(const LLSD& content) @@ -856,6 +856,8 @@ public: // we don't care about what the server returns from this post, just clean up the UI LLUploadDialog::modalUploadFinished(); } + + /*virtual*/ char const* getName(void) const { return "LLUserReportScreenshotResponder"; } }; class LLUserReportResponder : public LLHTTPClient::ResponderWithResult @@ -863,17 +865,18 @@ class LLUserReportResponder : public LLHTTPClient::ResponderWithResult public: LLUserReportResponder() { } - void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { // *TODO do some user messaging here LLUploadDialog::modalUploadFinished(); } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { // we don't care about what the server returns LLUploadDialog::modalUploadFinished(); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return userReportResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return userReportResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLUserReportResponder"; } }; void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url, const LLSD& report) diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 00701a11b..a30dc7099 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -64,6 +64,7 @@ #include "llviewerwindow.h" #include "llwindow.h" #include "llviewermenufile.h" // upload_new_resource() +#include "llresourcedata.h" #include "llfloaterpostcard.h" #include "llfloaterfeed.h" #include "llcheckboxctrl.h" @@ -73,6 +74,7 @@ #include "llworld.h" #include "llagentui.h" #include "llvoavatar.h" +#include "lluploaddialog.h" #include "llgl.h" #include "llglheaders.h" @@ -182,6 +184,7 @@ public: LLFloaterPostcard* savePostcard(); void saveTexture(); static void saveTextureDone(LLUUID const& asset_id, void* user_data, S32 status, LLExtStat ext_status); + static void saveTextureDone2(bool success, void* user_data); void saveLocal(); void saveStart(int index); void saveDone(ESnapshotType type, bool success, int index); @@ -383,7 +386,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mColor(1.f, 0.f, 0.f, 0.5f), mRawSnapshot(NULL), mRawSnapshotWidth(0), - mRawSnapshotHeight(0), + mRawSnapshotHeight(1), mRawSnapshotAspectRatio(1.0), mRawSnapshotRenderUI(FALSE), mRawSnapshotRenderHUD(FALSE), @@ -409,7 +412,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR), mCloseCalled(NULL) { - DoutEntering(dc::notice, "LLSnapshotLivePreview() [" << (void*)this << "]"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview() [" << (void*)this << "]"); setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")); mSnapshotDelayTimer.start(); sList.insert(this); @@ -430,7 +433,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : LLSnapshotLivePreview::~LLSnapshotLivePreview() { - DoutEntering(dc::notice, "~LLSnapshotLivePreview() [" << (void*)this << "]"); + DoutEntering(dc::snapshot, "~LLSnapshotLivePreview() [" << (void*)this << "]"); sList.erase(this); // Stop callbacks from using this object. ++sSnapshotIndex; @@ -455,7 +458,7 @@ LLViewerTexture* LLSnapshotLivePreview::getCurrentImage() void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show) { - DoutEntering(dc::notice, "LLSnapshotLivePreview::showFreezeFrameSnapshot(" << show << ")"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview::showFreezeFrameSnapshot(" << show << ")"); // If we stop to show the fullscreen "freeze frame" snapshot, play the "fall away" animation. if (mShowFreezeFrameSnapshot && !show) { @@ -471,7 +474,7 @@ void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show) void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) { - DoutEntering(dc::notice, "LLSnapshotLivePreview::updateSnapshot(" << new_snapshot << ", " << new_thumbnail << ", " << delay << ")"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview::updateSnapshot(" << new_snapshot << ", " << new_thumbnail << ", " << delay << ")"); LLRect& rect = mFullScreenImageRect; rect.set(0, getRect().getHeight(), getRect().getWidth(), 0); @@ -820,7 +823,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void) return ; } - Dout(dc::notice, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!"); + Dout(dc::snapshot, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!"); mThumbnailImage = NULL; @@ -843,7 +846,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void) { mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); mThumbnailUpToDate = TRUE ; - Dout(dc::notice, "thumbnailSnapshot(" << w << ", " << h << ", ...) returns " << raw->getWidth() << ", " << raw->getHeight()); + Dout(dc::snapshot, "thumbnailSnapshot(" << w << ", " << h << ", ...) returns " << raw->getWidth() << ", " << raw->getHeight()); } //unlock updating @@ -903,7 +906,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp) previewp->getWindow()->incBusyCount(); // Grab the raw image and encode it into desired format. - Dout(dc::notice, "LLSnapshotLivePreview::onIdle: Actually making a new snapshot!"); + Dout(dc::snapshot, "LLSnapshotLivePreview::onIdle: Actually making a new snapshot!"); // This should never happen, but well. If it's true then that means that the // snapshot floater is disabled. Incrementing sSnapshotIndex will cause the @@ -911,9 +914,10 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp) if (previewp->mCloseCalled) { previewp->mCloseCalled->setEnabled(TRUE); + previewp->mCloseCalled->setVisible(TRUE); } previewp->sSnapshotIndex++; - Dout(dc::notice, "sSnapshotIndex is now " << previewp->sSnapshotIndex << "; mOutstandingCallbacks reset to 0."); + Dout(dc::snapshot, "sSnapshotIndex is now " << previewp->sSnapshotIndex << "; mOutstandingCallbacks reset to 0."); previewp->mOutstandingCallbacks = 0; // There are no outstanding callbacks for THIS snapshot. previewp->mSaveFailures = 0; // There were no upload failures (or attempts for that matter) for this snapshot. @@ -930,7 +934,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp) previewp->mRawSnapshotAspectRatio = previewp->mAspectRatio; // Mark that the those values do not represent the current snapshot (yet). previewp->mRawSnapshotWidth = 0; - previewp->mRawSnapshotHeight = 0; + previewp->mRawSnapshotHeight = 1; // Avoid division by zero when calculation an aspect in LLSnapshotLivePreview::getAspectSizeProblem. if (gViewerWindow->rawRawSnapshot( previewp->mRawSnapshot, @@ -945,7 +949,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp) // On success, cache the size of the raw snapshot. previewp->mRawSnapshotWidth = previewp->mRawSnapshot->getWidth(); previewp->mRawSnapshotHeight = previewp->mRawSnapshot->getHeight(); - Dout(dc::notice, "Created a new raw snapshot of size " << previewp->mRawSnapshotWidth << "x" << previewp->mRawSnapshotHeight); + Dout(dc::snapshot, "Created a new raw snapshot of size " << previewp->mRawSnapshotWidth << "x" << previewp->mRawSnapshotHeight); previewp->mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal(); EAspectSizeProblem ret = previewp->generateFormattedAndFullscreenPreview(); @@ -1011,7 +1015,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr crop_vertically_out = false; if (!allow_horizontal_crop) { - Dout(dc::notice, "NOT up to date: required aspect " << mAspectRatio << + Dout(dc::snapshot, "NOT up to date: required aspect " << mAspectRatio << " is less than the (lower) raw aspect " << lower_raw_aspect << " which is already vertically cropped."); return CANNOT_CROP_HORIZONTALLY; } @@ -1025,7 +1029,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr { if (!allow_vertical_crop) { - Dout(dc::notice, "NOT up to date: required aspect " << mAspectRatio << + Dout(dc::snapshot, "NOT up to date: required aspect " << mAspectRatio << " is larger than the (upper) raw aspect " << upper_raw_aspect << " which is already horizontally cropped."); return CANNOT_CROP_VERTICALLY; } @@ -1035,7 +1039,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr // Never allow upscaling of the existing snapshot, of course. if (mWidth > width_out || mHeight > height_out) { - Dout(dc::notice, "NOT up to date: required target size " << mWidth << "x" << mHeight << + Dout(dc::snapshot, "NOT up to date: required target size " << mWidth << "x" << mHeight << " is larger than (cropped) raw snapshot with size " << width_out << "x" << height_out << "!"); return SIZE_TOO_LARGE; } @@ -1044,7 +1048,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr // unless the aspect is different in which case we have to allow resizing in one direction. if (mSnapshotType == SNAPSHOT_LOCAL && (mWidth >= window_width || mHeight >= window_height) && mWidth != width_out && mHeight != height_out) { - Dout(dc::notice, "NOT up to date: required target size " << mWidth << "x" << mHeight << + Dout(dc::snapshot, "NOT up to date: required target size " << mWidth << "x" << mHeight << " is larger or equal the window size (" << window_width << "x" << window_height << ")" " but unequal the (cropped) raw snapshot size (" << width_out << "x" << height_out << ")" " and target is disk!"); @@ -1055,7 +1059,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(bool delayed) { - DoutEntering(dc::notice, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")"); mFormattedUpToDate = false; S32 w, h, crop_offset; @@ -1101,7 +1105,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt (mFormattedSnapshotQuality == mSnapshotQuality || format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG)) { - Dout(dc::notice, "Already up to date."); + Dout(dc::snapshot, "Already up to date."); mFormattedUpToDate = true; return ret; } @@ -1109,43 +1113,43 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt #ifdef CWDEBUG if (!mFormattedImage) { - Dout(dc::notice, "mFormattedImage == NULL!"); + Dout(dc::snapshot, "mFormattedImage == NULL!"); } else { if (mFormattedWidth != mWidth) - Dout(dc::notice, "Target width changed from " << mFormattedWidth << " to " << mWidth); + Dout(dc::snapshot, "Target width changed from " << mFormattedWidth << " to " << mWidth); if (mFormattedHeight != mHeight) - Dout(dc::notice, "Target height changed from " << mFormattedHeight << " to " << mHeight); + Dout(dc::snapshot, "Target height changed from " << mFormattedHeight << " to " << mHeight); if (mFormattedRawWidth != w) - Dout(dc::notice, "Cropped (raw) width changed from " << mFormattedRawWidth << " to " << w); + Dout(dc::snapshot, "Cropped (raw) width changed from " << mFormattedRawWidth << " to " << w); if (mFormattedRawHeight != h) - Dout(dc::notice, "Cropped (raw) height changed from " << mFormattedRawHeight << " to " << h); + Dout(dc::snapshot, "Cropped (raw) height changed from " << mFormattedRawHeight << " to " << h); if (mFormattedCropOffset != crop_offset) - Dout(dc::notice, "Crop offset changed from " << mFormattedCropOffset << " to " << crop_offset); + Dout(dc::snapshot, "Crop offset changed from " << mFormattedCropOffset << " to " << crop_offset); if (mFormattedCropVertically != crop_vertically) - Dout(dc::notice, "Crop direction changed from " << (mFormattedCropVertically ? "vertical" : "horizontal") << " to " << (crop_vertically ? "vertical" : "horizontal")); + Dout(dc::snapshot, "Crop direction changed from " << (mFormattedCropVertically ? "vertical" : "horizontal") << " to " << (crop_vertically ? "vertical" : "horizontal")); if (mFormattedSnapshotFormat != format) - Dout(dc::notice, "Format changed from " << mFormattedSnapshotFormat << " to " << format); + Dout(dc::snapshot, "Format changed from " << mFormattedSnapshotFormat << " to " << format); if (!(mFormattedSnapshotQuality == mSnapshotQuality || format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG)) - Dout(dc::notice, "Format is JPEG and quality changed from " << mFormattedSnapshotQuality << " to " << mSnapshotQuality); + Dout(dc::snapshot, "Format is JPEG and quality changed from " << mFormattedSnapshotQuality << " to " << mSnapshotQuality); } #endif if (delayed) { // Just set mFormattedUpToDate. - Dout(dc::notice, "NOT up to date, but delayed. Returning."); + Dout(dc::snapshot, "NOT up to date, but delayed. Returning."); return DELAYED; } if (!mRawSnapshot) { - Dout(dc::notice, "No raw snapshot exists."); + Dout(dc::snapshot, "No raw snapshot exists."); return NO_RAW_IMAGE; } - Dout(dc::notice, "Generating a new formatted image!"); + Dout(dc::snapshot, "Generating a new formatted image!"); mFormattedWidth = mWidth; mFormattedHeight = mHeight; @@ -1313,7 +1317,7 @@ LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed() ++mOutstandingCallbacks; mSaveFailures = 0; addUsedBy(SNAPSHOT_FEED); - Dout(dc::notice, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); + Dout(dc::snapshot, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); if (mFullScreenPreviewTexture.isNull()) { @@ -1351,7 +1355,7 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard() ++mOutstandingCallbacks; mSaveFailures = 0; addUsedBy(SNAPSHOT_POSTCARD); - Dout(dc::notice, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); + Dout(dc::snapshot, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); if(mFullScreenPreviewTexture.isNull()) { @@ -1382,9 +1386,10 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard() class saveTextureUserData { public: - saveTextureUserData(LLSnapshotLivePreview* self, int index) : mSelf(self), mSnapshotIndex(index) { } + saveTextureUserData(LLSnapshotLivePreview* self, int index, bool temporary) : mSelf(self), mSnapshotIndex(index), mTemporary(temporary) { } LLSnapshotLivePreview* mSelf; int mSnapshotIndex; + bool mTemporary; }; void LLSnapshotLivePreview::saveTexture() @@ -1397,7 +1402,7 @@ void LLSnapshotLivePreview::saveTexture() ++mOutstandingCallbacks; mSaveFailures = 0; addUsedBy(SNAPSHOT_TEXTURE); - Dout(dc::notice, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); + Dout(dc::snapshot, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); saveStart(sSnapshotIndex); // gen a new uuid for this asset @@ -1411,7 +1416,8 @@ void LLSnapshotLivePreview::saveTexture() LLAgentUI::buildFullname(who_took_it); LLAssetStorage::LLStoreAssetCallback callback = &LLSnapshotLivePreview::saveTextureDone; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); - upload_new_resource(tid, // tid + saveTextureUserData* user_data = new saveTextureUserData(this, sSnapshotIndex, gSavedSettings.getBOOL("TemporaryUpload")); + if (!upload_new_resource(tid, // tid LLAssetType::AT_TEXTURE, "Snapshot : " + pos_string, "Taken by " + who_took_it + " at " + pos_string, @@ -1422,7 +1428,12 @@ void LLSnapshotLivePreview::saveTexture() LLFloaterPerms::getGroupPerms(), // that is more permissive than other uploads LLFloaterPerms::getEveryonePerms(), "Snapshot : " + pos_string, - callback, expected_upload_cost, new saveTextureUserData(this, sSnapshotIndex)); + callback, expected_upload_cost, user_data, &LLSnapshotLivePreview::saveTextureDone2)) + { + // Something went wrong. + delete user_data; + saveDone(SNAPSHOT_TEXTURE, false, sSnapshotIndex); + } gViewerWindow->playSnapshotAnimAndSound(); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); @@ -1438,7 +1449,7 @@ void LLSnapshotLivePreview::saveLocal() ++mOutstandingCallbacks; mSaveFailures = 0; addUsedBy(SNAPSHOT_LOCAL); - Dout(dc::notice, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); + Dout(dc::snapshot, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); saveStart(sSnapshotIndex); gViewerWindow->saveImageNumbered(mFormattedImage, sSnapshotIndex); // This calls saveDone() immediately, or later. @@ -1446,7 +1457,7 @@ void LLSnapshotLivePreview::saveLocal() void LLSnapshotLivePreview::close(LLFloaterSnapshot* view) { - DoutEntering(dc::notice, "LLSnapshotLivePreview::close(" << (void*)view << ") [mOutstandingCallbacks = " << mOutstandingCallbacks << "]"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview::close(" << (void*)view << ") [mOutstandingCallbacks = " << mOutstandingCallbacks << "]"); mCloseCalled = view; if (!mOutstandingCallbacks) { @@ -1454,6 +1465,7 @@ void LLSnapshotLivePreview::close(LLFloaterSnapshot* view) } else { + view->setVisible(FALSE); view->setEnabled(FALSE); } } @@ -1479,11 +1491,11 @@ void LLSnapshotLivePreview::saveStart(int index) void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index) { - DoutEntering(dc::notice, "LLSnapshotLivePreview::saveDone(" << type << ", " << success << ", " << index << ")"); + DoutEntering(dc::snapshot, "LLSnapshotLivePreview::saveDone(" << type << ", " << success << ", " << index << ")"); if (sSnapshotIndex != index) { - Dout(dc::notice, "sSnapshotIndex (" << sSnapshotIndex << ") != index (" << index << ")"); + Dout(dc::snapshot, "sSnapshotIndex (" << sSnapshotIndex << ") != index (" << index << ")"); // The snapshot was already replaced, so this callback has nothing to do with us anymore. if (!success) @@ -1494,7 +1506,7 @@ void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index } --mOutstandingCallbacks; - Dout(dc::notice, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); + Dout(dc::snapshot, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); if (!success) { ++mSaveFailures; @@ -1508,16 +1520,36 @@ void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index } } +// This callback is only used for the *legacy* LLViewerAssetStorage::storeAssetData +// (when the cap NewFileAgentInventory is not available) and temporaries. +// See upload_new_resource. //static void LLSnapshotLivePreview::saveTextureDone(LLUUID const& asset_id, void* user_data, S32 status, LLExtStat ext_status) { - bool success = status != LL_ERR_NOERR; + LLResourceData* resource_data = (LLResourceData*)user_data; + + bool success = status == LL_ERR_NOERR; if (!success) { LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("UploadSnapshotFail", args); } + saveTextureUserData* data = (saveTextureUserData*)resource_data->mUserData; + bool temporary = data->mTemporary; + data->mSelf->saveDone(SNAPSHOT_TEXTURE, success, data->mSnapshotIndex); + delete data; + + // Call the default call back. + LLAssetStorage::LLStoreAssetCallback asset_callback = temporary ? &temp_upload_callback : &upload_done_callback; + (*asset_callback)(asset_id, user_data, status, ext_status); +} + +// This callback used when the capability NewFileAgentInventory is available and it wasn't a temporary. +// See upload_new_resource. +//static +void LLSnapshotLivePreview::saveTextureDone2(bool success, void* user_data) +{ saveTextureUserData* data = (saveTextureUserData*)user_data; data->mSelf->saveDone(SNAPSHOT_TEXTURE, success, data->mSnapshotIndex); delete data; @@ -1541,6 +1573,8 @@ void LLSnapshotLivePreview::doCloseAfterSave() else { mCloseCalled->setEnabled(TRUE); + mCloseCalled->setVisible(TRUE); + gFloaterView->bringToFront(mCloseCalled); mCloseCalled = NULL; } } @@ -1623,7 +1657,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) S32 delta_height = 0; if (!gSavedSettings.getBOOL("AdvanceSnapshot")) { - floaterp->getChild("feed_size_combo")->setCurrentByIndex(2); // 500x375 + floaterp->getChild("feed_size_combo")->setCurrentByIndex(2); // 500x375 (4:3) gSavedSettings.setS32("SnapshotFeedLastResolution", 2); floaterp->getChild("postcard_size_combo")->setCurrentByIndex(0); // Current window @@ -1660,8 +1694,8 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on) // can see and interact with fullscreen preview now if (previewp) { - previewp->setVisible(TRUE); previewp->setEnabled(TRUE); + previewp->setVisible(TRUE); } // Freeze all avatars. @@ -1717,7 +1751,7 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on) // static void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool delayed_formatted) { - DoutEntering(dc::notice, "LLFloaterSnapshot::Impl::updateControls()"); + DoutEntering(dc::snapshot, "LLFloaterSnapshot::Impl::updateControls()"); std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); if (gSavedSettings.getBOOL("TemporaryUpload")) { @@ -2018,6 +2052,7 @@ void LLFloaterSnapshot::saveLocalDone(bool success, int index) //static void LLFloaterSnapshot::saveFeedDone(bool success, int index) { + LLUploadDialog::modalUploadFinished(); LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(); if (previewp) { @@ -2028,6 +2063,7 @@ void LLFloaterSnapshot::saveFeedDone(bool success, int index) //static void LLFloaterSnapshot::savePostcardDone(bool success, int index) { + LLUploadDialog::modalUploadFinished(); LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(); if (previewp) { @@ -2223,7 +2259,7 @@ void LLFloaterSnapshot::Impl::onCommitQuality(LLUICtrl* ctrl, void* data) //static void LLFloaterSnapshot::Impl::onQualityMouseUp(void* data) { - Dout(dc::notice, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()"); + Dout(dc::snapshot, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()"); LLFloaterSnapshot* view = (LLFloaterSnapshot *)data; updateControls(view); } @@ -2502,6 +2538,15 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); } } + else if (height == -2) + { + // The size is actually the source aspect now, encoded in the width. + F32 source_aspect = width / 630.f; + // Use the size of the current window, cropped to the required aspect. + width = llmin(gViewerWindow->getWindowDisplayWidth(), llround(gViewerWindow->getWindowDisplayHeight() * source_aspect)); + height = llmin(gViewerWindow->getWindowDisplayHeight(), llround(gViewerWindow->getWindowDisplayWidth() / source_aspect)); + previewp->setSize(width, height); + } else { // use the resolution from the selected pre-canned drop-down choice @@ -2948,9 +2993,9 @@ void LLFloaterSnapshot::onOpen() void LLFloaterSnapshot::onClose(bool app_quitting) { - gSnapshotFloaterView->setEnabled(FALSE); // Set invisible so it doesn't eat tooltips. JC gSnapshotFloaterView->setVisible(FALSE); + gSnapshotFloaterView->setEnabled(FALSE); gSavedSettings.setBOOL("SnapshotBtnState", FALSE); impl.freezeTime(false); destroy(); @@ -2980,6 +3025,8 @@ void LLFloaterSnapshot::show(void*) sInstance->open(); /* Flawfinder: ignore */ sInstance->focusFirstItem(FALSE); + sInstance->setEnabled(TRUE); + sInstance->setVisible(TRUE); gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setVisible(TRUE); gSnapshotFloaterView->adjustToFitScreen(sInstance, FALSE); @@ -3090,7 +3137,7 @@ BOOL LLFloaterSnapshot::handleMouseUp(S32 x, S32 y, MASK mask) LLSnapshotFloaterView::LLSnapshotFloaterView( const std::string& name, const LLRect& rect ) : LLFloaterView(name, rect) { - setMouseOpaque(TRUE); + setMouseOpaque(FALSE); setEnabled(FALSE); } diff --git a/indra/newview/llfloaterteleport.cpp b/indra/newview/llfloaterteleport.cpp index 04ca6d499..dd546c5b0 100644 --- a/indra/newview/llfloaterteleport.cpp +++ b/indra/newview/llfloaterteleport.cpp @@ -63,8 +63,7 @@ extern AIHTTPTimeoutPolicy placeAvatarTeleportResponder_timeout; // OGPX TODO: should this be combined with the Login responder for rez_avatar/place? // OGPX TODO: mResult should not get replaced in result(), instead // should replace individual LLSD fields in mResult. -class LLPlaceAvatarTeleportResponder : - public LLHTTPClient::ResponderWithResult +class LLPlaceAvatarTeleportResponder : public LLHTTPClient::ResponderWithResult { public: LLPlaceAvatarTeleportResponder() @@ -75,7 +74,7 @@ public: { } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { LL_INFOS("OGPX") << "LLPlaceAvatarTeleportResponder error in TP " << statusNum << " " << reason << LL_ENDL; @@ -90,7 +89,7 @@ public: } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { LLSD result; @@ -221,7 +220,8 @@ public: } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return placeAvatarTeleportResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return placeAvatarTeleportResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLPlaceAvatarTeleportResponder"; } }; // Statics diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index e5237e8f2..e58b1783e 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -113,13 +113,13 @@ class LLIamHere : public LLHTTPClient::ResponderWithResult mParent = parentIn; }; - virtual void result( const LLSD& content ) + /*virtual*/ void result( const LLSD& content ) { if ( mParent ) mParent->setSiteIsAlive( true ); }; - virtual void error( U32 status, const std::string& reason ) + /*virtual*/ void error( U32 status, const std::string& reason ) { if ( mParent ) { @@ -131,7 +131,8 @@ class LLIamHere : public LLHTTPClient::ResponderWithResult } }; - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHere_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHere_timeout; } + /*virtual*/ char const* getName(void) const { return "LLIamHere"; } }; // this is global and not a class member to keep crud out of the header file diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 60d6ad963..122cfd60f 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -62,7 +62,7 @@ public: LLHandle mParent; - virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) + /*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) { if (200 <= status && status < 300) { @@ -89,7 +89,9 @@ public: floater_url_entry->headerFetchComplete( status, resolved_mime_type ); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mediaTypeResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mediaTypeResponder_timeout; } + + /*virtual*/ char const* getName(void) const { return "LLMediaTypeResponder"; } }; //----------------------------------------------------------------------------- diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 3cde11774..ea0014b1b 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1896,12 +1896,12 @@ extern AIHTTPTimeoutPolicy groupMemberDataResponder_timeout; class GroupMemberDataResponder : public LLHTTPClient::ResponderWithResult { public: - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupMemberDataResponder_timeout; } - GroupMemberDataResponder() {} virtual ~GroupMemberDataResponder() {} - virtual void result(const LLSD& pContent); - virtual void error(U32 pStatus, const std::string& pReason); + /*virtual*/ void result(const LLSD& pContent); + /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupMemberDataResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "GroupMemberDataResponder"; } private: LLSD mMemberData; }; diff --git a/indra/newview/llhomelocationresponder.h b/indra/newview/llhomelocationresponder.h index c9d098740..9ffffc304 100644 --- a/indra/newview/llhomelocationresponder.h +++ b/indra/newview/llhomelocationresponder.h @@ -44,9 +44,10 @@ extern AIHTTPTimeoutPolicy homeLocationResponder_timeout; /* Typedef, Enum, Class, Struct, etc. */ class LLHomeLocationResponder : public LLHTTPClient::ResponderWithResult { - virtual void result( const LLSD& content ); - virtual void error( U32 status, const std::string& reason ); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return homeLocationResponder_timeout; } + /*virtual*/ void result( const LLSD& content ); + /*virtual*/ void error( U32 status, const std::string& reason ); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return homeLocationResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLHomeLocationResponder"; } }; #endif diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 65617418f..1a2860998 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -199,7 +199,7 @@ public: mAgents = agents_to_invite; } - virtual void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { //try an "old school" way. if ( statusNum == 400 ) @@ -219,7 +219,8 @@ public: //the possible different language translations } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return startConferenceChatResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return startConferenceChatResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLStartConferenceChatResponder"; } private: LLUUID mTempSessionID; @@ -306,9 +307,10 @@ class LLVoiceCallCapResponder : public LLHTTPClient::ResponderWithResult public: LLVoiceCallCapResponder(const LLUUID& session_id) : mSessionID(session_id) {}; - virtual void error(U32 status, const std::string& reason); // called with bad status codes - virtual void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceCallCapResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); // called with bad status codes + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceCallCapResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLVoiceCallCapResponder"; } private: LLUUID mSessionID; @@ -1185,40 +1187,42 @@ void LLFloaterIMPanel::init(const std::string& session_label) mProfileButtonEnabled = FALSE; // [/Ansariel: Display name support] - static LLCachedControl concisebuttons("UseConciseIMButtons"); + static LLCachedControl concise_im("UseConciseIMButtons"); + static LLCachedControl concise_group("UseConciseGroupChatButtons"); + static LLCachedControl concise_conf("UseConciseConferenceButtons"); std::string xml_filename; switch(mDialog) { case IM_SESSION_GROUP_START: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_group.xml"; + xml_filename = concise_group ? "floater_instant_message_group_concisebuttons.xml" : "floater_instant_message_group.xml"; mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel); break; case IM_SESSION_INVITE: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); if (gAgent.isInGroup(mSessionUUID)) { - xml_filename = "floater_instant_message_group.xml"; + xml_filename = concise_group ? "floater_instant_message_group_concisebuttons.xml" : "floater_instant_message_group.xml"; } else // must be invite to ad hoc IM { - xml_filename = "floater_instant_message_ad_hoc.xml"; + xml_filename = concise_conf ? "floater_instant_message_ad_hoc_concisebuttons.xml" : "floater_instant_message_ad_hoc.xml"; } mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel); break; case IM_SESSION_P2P_INVITE: - xml_filename = concisebuttons ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; + xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID); break; case IM_SESSION_CONFERENCE_START: mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this); - xml_filename = "floater_instant_message_ad_hoc.xml"; + xml_filename = concise_conf ? "floater_instant_message_ad_hoc_concisebuttons.xml" : "floater_instant_message_ad_hoc.xml"; mVoiceChannel = new LLVoiceChannelGroup(mSessionUUID, mSessionLabel); break; // just received text from another user case IM_NOTHING_SPECIAL: - xml_filename = concisebuttons ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; + xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID); mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID); @@ -1228,7 +1232,7 @@ void LLFloaterIMPanel::init(const std::string& session_label) break; default: llwarns << "Unknown session type" << llendl; - xml_filename = concisebuttons ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; + xml_filename = concise_im ? "floater_instant_message_concisebuttons.xml" : "floater_instant_message.xml"; break; } @@ -1563,13 +1567,14 @@ public: mSessionID = session_id; } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { llinfos << "Error inviting all agents to session" << llendl; //throw something back to the viewer here? } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return sessionInviteResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return sessionInviteResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLSessionInviteResponder"; } private: LLUUID mSessionID; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index fb8a783ba..62f52c759 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -94,8 +94,7 @@ LLIMMgr* gIMMgr = NULL; //{ // return (LLStringUtil::compareDict( a->mName, b->mName ) < 0); //} -class LLViewerChatterBoxInvitationAcceptResponder : - public LLHTTPClient::ResponderWithResult +class LLViewerChatterBoxInvitationAcceptResponder : public LLHTTPClient::ResponderWithResult { public: LLViewerChatterBoxInvitationAcceptResponder( @@ -106,7 +105,7 @@ public: mInvitiationType = invitation_type; } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if ( gIMMgr) { @@ -154,8 +153,8 @@ public: } } - void error(U32 statusNum, const std::string& reason) - { + /*virtual*/ void error(U32 statusNum, const std::string& reason) + { //throw something back to the viewer here? if ( gIMMgr ) { @@ -177,7 +176,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerChatterBoxInvitationAcceptResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerChatterBoxInvitationAcceptResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLViewerChatterBoxInvitationAcceptResponder"; } private: LLUUID mSessionID; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index cacdc559a..4764a47b1 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -483,12 +483,12 @@ public: { } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { LL_WARNS("InvAPI") << "CreateInventoryCategory failed. status = " << status << ", reasion = \"" << reason << "\"" << LL_ENDL; } - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { //Server has created folder. @@ -515,7 +515,8 @@ public: } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return createInventoryCategoryResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return createInventoryCategoryResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLCreateInventoryCategoryResponder"; } private: void (*mCallback)(const LLSD&, void*); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index b22efb9eb..3f87c2615 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -87,9 +87,10 @@ public: { public: fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fetchInventoryResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fetchInventoryResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "fetchInventoryResponder"; } protected: LLSD mRequestSD; }; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index d1ed71e8b..eeec545c9 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -376,9 +376,10 @@ class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInvento { public: LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchItemResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchItemResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLInventoryModelFetchItemResponder"; } }; void LLInventoryModelFetchItemResponder::result( const LLSD& content ) @@ -393,7 +394,7 @@ void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& r LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); } -class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::ResponderWithResult +class LLInventoryModelFetchDescendentsResponder : public LLHTTPClient::ResponderWithResult { public: LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) : @@ -401,9 +402,10 @@ class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::ResponderW mRecursiveCatUUIDs(recursive_cats) {}; //LLInventoryModelFetchDescendentsResponder() {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchDescendentsResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchDescendentsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLInventoryModelFetchDescendentsResponder"; } protected: BOOL getIsRecursive(const LLUUID& cat_id) const; diff --git a/indra/newview/llmapresponders.h b/indra/newview/llmapresponders.h index 8b287c9fb..835722348 100644 --- a/indra/newview/llmapresponders.h +++ b/indra/newview/llmapresponders.h @@ -40,8 +40,9 @@ extern AIHTTPTimeoutPolicy mapLayerResponder_timeout; class LLMapLayerResponder : public LLHTTPClient::ResponderWithResult { - virtual void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mapLayerResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mapLayerResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMapLayerResponder"; } }; #endif // LL_LLMAPLAYERRESPONDER_H diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index f9da070e2..0b19efde6 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -157,9 +157,7 @@ namespace LLMarketplaceImport class LLImportPostResponder : public LLHTTPClient::ResponderWithCompleted { public: - AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportPostResponder_timeout; } - - void completed(U32 status, const std::string& reason, const LLSD& content) + /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { slmPostTimer.stop(); @@ -189,13 +187,14 @@ namespace LLMarketplaceImport sImportResultStatus = status; sImportId = content; } + + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportPostResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLImportPostResponder"; } }; class LLImportGetResponder : public LLHTTPClient::ResponderWithCompleted { public: - AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportGetResponder_timeout; } - /*virtual*/ bool followRedir(void) const { return true; } /*virtual*/ bool needsHeaders(void) const { return true; } @@ -215,7 +214,7 @@ namespace LLMarketplaceImport } } - void completed(U32 status, const std::string& reason, const LLSD& content) + /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { slmGetTimer.stop(); @@ -244,6 +243,9 @@ namespace LLMarketplaceImport sImportResultStatus = status; sImportResults = content; } + + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportGetResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLImportGetResponder"; } }; // Basic API diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 74f090532..260c3cc87 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -226,11 +226,12 @@ public: LLMeshRepoThread::sActiveHeaderRequests--; } - virtual void completedRaw(U32 status, const std::string& reason, + /*virtual*/ void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshHeaderResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshHeaderResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMeshHeaderResponder"; } }; class LLMeshLODResponder : public LLHTTPClient::ResponderWithCompleted @@ -252,11 +253,12 @@ public: LLMeshRepoThread::sActiveLODRequests--; } - virtual void completedRaw(U32 status, const std::string& reason, + /*virtual*/ void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshLODResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshLODResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMeshLODResponder"; } }; class LLMeshSkinInfoResponder : public LLHTTPClient::ResponderWithCompleted @@ -271,11 +273,12 @@ public: { } - virtual void completedRaw(U32 status, const std::string& reason, + /*virtual*/ void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshSkinInfoResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshSkinInfoResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMeshSkinInfoResponder"; } }; class LLMeshDecompositionResponder : public LLHTTPClient::ResponderWithCompleted @@ -290,11 +293,12 @@ public: { } - virtual void completedRaw(U32 status, const std::string& reason, + /*virtual*/ void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshDecompositionResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshDecompositionResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMeshDecompositionResponder"; } }; class LLMeshPhysicsShapeResponder : public LLHTTPClient::ResponderWithCompleted @@ -309,11 +313,12 @@ public: { } - virtual void completedRaw(U32 status, const std::string& reason, + /*virtual*/ void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshPhysicsShapeResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return meshPhysicsShapeResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMeshPhysicsShapeResponder"; } }; #if MESH_IMPORT @@ -366,7 +371,7 @@ void log_upload_error(S32 status, const LLSD& content, std::string stage, std::s } } -class LLWholeModelFeeResponder: public LLHTTPClient::ResponderWithCompleted +class LLWholeModelFeeResponder : public LLHTTPClient::ResponderWithCompleted { LLMeshUploadThread* mThread; LLSD mModelData; @@ -378,7 +383,7 @@ public: mObserverHandle(observer_handle) { } - virtual void completed(U32 status, + /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { @@ -417,10 +422,11 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelFeeResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelFeeResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLWholeModelFeeResponder"; } }; -class LLWholeModelUploadResponder: public LLHTTPClient::ResponderWithCompleted +class LLWholeModelUploadResponder : public LLHTTPClient::ResponderWithCompleted { LLMeshUploadThread* mThread; LLSD mModelData; @@ -433,7 +439,7 @@ public: mObserverHandle(observer_handle) { } - virtual void completed(U32 status, + /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { @@ -475,7 +481,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelUploadResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return wholeModelUploadResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLWholeModelUploadResponder"; } }; #endif //MESH_IMPORT diff --git a/indra/newview/llpanelgroupvoting.cpp b/indra/newview/llpanelgroupvoting.cpp index 3af05adc6..0eac7e5ec 100644 --- a/indra/newview/llpanelgroupvoting.cpp +++ b/indra/newview/llpanelgroupvoting.cpp @@ -693,7 +693,7 @@ public: } //If we get back a normal response, handle it here - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { //Ack'd the proposal initialization, now let's finish up. LLPanelGroupVoting::handleResponse( @@ -702,7 +702,7 @@ public: } //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llinfos << "LLPanelGroupVotingResponder::error " << status << ": " << reason << llendl; @@ -710,8 +710,8 @@ public: LLPanelGroupVoting::handleFailure(mGroupID); } - //Return our timeout policy. - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return startGroupVoteResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return startGroupVoteResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLStartGroupVoteResponder"; } private: LLUUID mGroupID; @@ -726,7 +726,7 @@ public: } //If we get back a normal response, handle it here - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { //Ack'd the proposal initialization, now let's finish up. LLPanelGroupVoting::handleResponse( @@ -736,7 +736,7 @@ public: } //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llinfos << "LLPanelGroupVotingResponder::error " << status << ": " << reason << llendl; @@ -745,7 +745,8 @@ public: } //Return out timeout policy. - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupProposalBallotResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupProposalBallotResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLGroupProposalBallotResponder"; } private: LLUUID mGroupID; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 134363bce..99991e769 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -192,7 +192,9 @@ class LLIamHereLogin : public LLHTTPClient::ResponderHeadersOnly } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHereLogin_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return iamHereLogin_timeout; } + + /*virtual*/ char const* getName(void) const { return "LLIamHereLogin"; } }; // this is global and not a class member to keep crud out of the header file diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 4f23117cc..274180174 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -116,9 +116,10 @@ public: NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly); virtual ~NavMeshStatusResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshStatusResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshStatusResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "NavMeshStatusResponder"; } protected: @@ -139,9 +140,10 @@ public: NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr); virtual ~NavMeshResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "NavMeshResponder"; } protected: @@ -161,9 +163,10 @@ public: AgentStateResponder(const std::string &pCapabilityURL); virtual ~AgentStateResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return agentStateResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return agentStateResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "AgentStateResponder"; } protected: @@ -181,9 +184,10 @@ public: NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback); virtual ~NavMeshRebakeResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string& pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshRebakeResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string& pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshRebakeResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "NavMeshRebakeResponder"; } protected: @@ -241,9 +245,10 @@ public: ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); virtual ~ObjectLinksetsResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectLinksetsResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string &pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectLinksetsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "ObjectLinksetsResponder"; } protected: @@ -261,9 +266,10 @@ public: TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); virtual ~TerrainLinksetsResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return terrainLinksetsResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string &pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return terrainLinksetsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "TerrainLinksetsResponder"; } protected: @@ -281,9 +287,10 @@ public: CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback); virtual ~CharactersResponder(); - virtual void result(const LLSD &pContent); - virtual void error(U32 pStatus, const std::string &pReason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return charactersResponder_timeout; } + /*virtual*/ void result(const LLSD &pContent); + /*virtual*/ void error(U32 pStatus, const std::string &pReason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return charactersResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "CharactersResponder"; } protected: diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp index ff9014deb..27aeea77e 100644 --- a/indra/newview/llproductinforequest.cpp +++ b/indra/newview/llproductinforequest.cpp @@ -46,19 +46,20 @@ class LLProductInfoRequestResponder : public LLHTTPClient::ResponderWithResult { public: //If we get back a normal response, handle it here - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { LLProductInfoRequestManager::instance().setSkuDescriptions(content); } //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { llwarns << "LLProductInfoRequest::error(" << status << ": " << reason << ")" << llendl; } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return productInfoRequestResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return productInfoRequestResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLProductInfoRequestResponder"; } }; LLProductInfoRequestManager::LLProductInfoRequestManager() : mSkuDescriptions() diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index abc62a10e..6d212e3e4 100644 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -46,10 +46,11 @@ class LLRemoteParcelRequestResponder : public LLHTTPClient::ResponderWithResult public: LLRemoteParcelRequestResponder(LLHandle place_panel_handle); //If we get back a normal response, handle it here - virtual void result(const LLSD& content); + /*virtual*/ void result(const LLSD& content); //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLRemoteParcelRequestResponder"; } protected: LLHandle mPlacePanelHandle; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 84096d94a..1d8207238 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -312,8 +312,6 @@ public: { } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return HTTPGetResponder_timeout; } - #if 0 //Apparently, SL never sends content-range and instead sends transfer-encoding: chunked, so disabling for now /*virtual*/ bool needsHeaders(void) const { return true; } @@ -413,6 +411,9 @@ public: return mFollowRedir; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return HTTPGetResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "HTTPGetResponder"; } + private: LLTextureFetch* mFetcher; LLUUID mID; @@ -3107,8 +3108,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) mFetcher->decrCurlPOSTCount(); } - // virtual - void error(U32 status_num, const std::string & reason) + /*virtual*/ void error(U32 status_num, const std::string & reason) { if (mLiveSequence == mExpectedSequence) { @@ -3118,8 +3118,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) << reason << LL_ENDL; } - // virtual - void result(const LLSD & content) + /*virtual*/ void result(const LLSD & content) { if (mLiveSequence == mExpectedSequence) { @@ -3127,7 +3126,8 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) mReportingStarted = true; } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return lcl_responder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return lcl_responder_timeout; } + /*virtual*/ char const* getName(void) const { return "lcl_responder"; } private: LLTextureFetch * mFetcher; diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index 7540dd72c..769afc378 100644 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -43,7 +43,7 @@ extern AIHTTPTimeoutPolicy translationReceiver_timeout; class LLTranslate { public : - class TranslationReceiver: public LLHTTPClient::ResponderWithResult + class TranslationReceiver : public LLHTTPClient::ResponderWithResult { protected: TranslationReceiver(const std::string &fromLang, const std::string &toLang) @@ -60,15 +60,13 @@ public : { } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { LL_WARNS("Translate") << "URL Request error: " << reason << LL_ENDL; handleFailure(); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return translationReceiver_timeout; } - - virtual void completedRaw( + /*virtual*/ void completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, @@ -100,6 +98,8 @@ public : handleResponse(translation, detectedLanguage); } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return translationReceiver_timeout; } + protected: const std::string m_toLang; const std::string m_fromLang; diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp index a860e5303..a4f758ff8 100644 --- a/indra/newview/lluploaddialog.cpp +++ b/indra/newview/lluploaddialog.cpp @@ -75,7 +75,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) } LLUploadDialog::sDialog = this; - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_BIG ); LLRect msg_rect; for (int line_num=0; line_num<16; ++line_num) { @@ -91,7 +91,10 @@ LLUploadDialog::LLUploadDialog( const std::string& msg) void LLUploadDialog::setMessage( const std::string& msg) { - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); + S32 const min_width = gViewerWindow->getWindowWidthRaw() / 10; + S32 const min_height = gViewerWindow->getWindowHeightRaw() / 10; + + const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_BIG ); const S32 VPAD = 16; const S32 HPAD = 25; @@ -127,14 +130,14 @@ void LLUploadDialog::setMessage( const std::string& msg) S32 line_height = S32( font->getLineHeight() + 0.99f ); - S32 dialog_width = max_msg_width + 2 * HPAD; - S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; + S32 dialog_width = llmax(max_msg_width + 2 * HPAD, min_width); + S32 dialog_height = llmax(line_height * (S32)msg_lines.size() + 2 * VPAD, min_height); reshape( dialog_width, dialog_height, FALSE ); // Message S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; - S32 msg_y = getRect().getHeight() - VPAD - line_height; + S32 msg_y = (getRect().getHeight() + line_height * msg_lines.size()) / 2 - line_height; int line_num; for (line_num=0; line_num<16; ++line_num) { diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h index 85cc7b86a..0ddba6735 100644 --- a/indra/newview/lluploadfloaterobservers.h +++ b/indra/newview/lluploadfloaterobservers.h @@ -104,11 +104,10 @@ public: LLUploadModelPremissionsResponder(const LLHandle& observer); - void error(U32 status, const std::string& reason); - - void result(const LLSD& content); - - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return uploadModelPremissionsResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return uploadModelPremissionsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLUploadModelPremissionsResponder"; } private: LLHandle mObserverHandle; diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index 0c917ef4e..ea38be2cb 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -68,7 +68,8 @@ public: LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return setDisplayNameResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return setDisplayNameResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLSetDisplayNameResponder"; } }; void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 9599ae0cc..3e8b49b98 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -117,6 +117,8 @@ public: /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mimeDiscoveryResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLMimeDiscoveryResponder"; } + public: viewer_media_t mMediaImpl; std::string mDefaultMimeType; @@ -135,16 +137,16 @@ public: { } - /* virtual */ bool needsHeaders(void) const { return true; } + /*virtual*/ bool needsHeaders(void) const { return true; } - /* virtual */ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) + /*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) { LL_DEBUGS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; LL_DEBUGS("MediaAuth") << headers << LL_ENDL; LLViewerMedia::openIDCookieResponse(get_cookie("agni_sl_session_id")); } - /* virtual */ void completedRaw( + /*virtual*/ void completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, @@ -154,26 +156,21 @@ public: // We don't care about the content of the response, only the set-cookie header. } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaOpenIDResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaOpenIDResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLViewerMediaOpenIDResponder"; } }; class LLViewerMediaWebProfileResponder : public LLHTTPClient::ResponderWithCompleted { LOG_CLASS(LLViewerMediaWebProfileResponder); public: - LLViewerMediaWebProfileResponder(std::string host) - { - mHost = host; - } + LLViewerMediaWebProfileResponder(std::string host) : mHost(host) { } + ~LLViewerMediaWebProfileResponder() { } - ~LLViewerMediaWebProfileResponder() - { - } + /*virtual*/ bool followRedir(void) const { return true; } + /*virtual*/ bool needsHeaders(void) const { return true; } - /* virtual */ bool followRedir(void) const { return true; } - /* virtual */ bool needsHeaders(void) const { return true; } - - /* virtual */ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) + /*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) { LL_INFOS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; LL_INFOS("MediaAuth") << headers << LL_ENDL; @@ -204,7 +201,7 @@ public: } } - void completedRaw( + /*virtual*/ void completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, @@ -214,8 +211,10 @@ public: // We don't care about the content of the response, only the set-cookie header. } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaWebProfileResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerMediaWebProfileResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLViewerMediaWebProfileResponder"; } +private: std::string mHost; }; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 0c1fa71a5..b5a4863d3 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -1155,7 +1155,7 @@ LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type, return body; } -void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, +bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_type, std::string name, std::string desc, S32 compression_info, LLFolderType::EType destination_folder_type, @@ -1166,11 +1166,12 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty const std::string& display_name, LLAssetStorage::LLStoreAssetCallback callback, S32 expected_upload_cost, - void *userdata) + void *userdata, + void (*callback2)(bool, void*)) { if(gDisconnected) { - return ; + return false; } @@ -1207,7 +1208,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost); LLHTTPClient::post(url, body, - new LLNewAgentInventoryResponder(body, uuid, asset_type)); + new LLNewAgentInventoryResponder(body, uuid, asset_type, callback2, userdata)); } else { @@ -1230,7 +1231,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); args["[AMOUNT]"] = llformat("%d", expected_upload_cost); LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); - return; + return false; } } } @@ -1260,6 +1261,9 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty TRUE, temporary); } + + // Return true when a call to a callback function will follow. + return true; } LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid) diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 85bd7e166..426a5a4bf 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -66,7 +66,8 @@ void upload_new_resource(const std::string& src_filename, S32 expected_upload_cost, void *userdata); -void upload_new_resource(const LLTransactionID &tid, +// Return false if no upload attempt was done (and the callback will not be called). +bool upload_new_resource(const LLTransactionID &tid, LLAssetType::EType type, std::string name, std::string desc, @@ -79,7 +80,13 @@ void upload_new_resource(const LLTransactionID &tid, const std::string& display_name, LLAssetStorage::LLStoreAssetCallback callback, S32 expected_upload_cost, - void *userdata); + void *userdata, + void (*callback2)(bool, void*) = NULL); + +// The default callback functions, called when 'callback' == NULL (for normal and temporary uploads). +// user_data must be a LLResourceData allocated with new (or NULL). +void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); +void temp_upload_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 32d553aae..80cc2fb2a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3309,6 +3309,8 @@ protected: delete m_chat; } + /*virtual*/ char const* getName(void) const { return "ChatTranslationReceiver"; } + private: LLChat *m_chat; const BOOL m_history; @@ -3373,6 +3375,7 @@ protected: } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return authHandler_timeout; } + /*virtual*/ char const* getName(void) const { return "AuthHandler"; } }; void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index e08968f42..7ca8c41bc 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -111,7 +111,7 @@ void setDefaultTextures() } } -class importResponder: public LLNewAgentInventoryResponder +class importResponder : public LLNewAgentInventoryResponder { public: @@ -191,6 +191,8 @@ public: LLObjectBackup::getInstance()->updateMap(content["new_asset"].asUUID()); LLObjectBackup::getInstance()->uploadNextAsset(); } + + /*virtual*/ char const* getName(void) const { return "importResponder"; } }; class CacheReadResponder : public LLTextureCache::ReadResponder diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 3f1c023df..619300455 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -714,7 +714,7 @@ public: } } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { llwarns << "Transport error requesting object cost " @@ -726,7 +726,7 @@ public: clear_object_list_pending_requests(); } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if ( !content.isMap() || content.has("error") ) { @@ -776,7 +776,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectCostResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectCostResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLObjectCostResponder"; } private: LLSD mObjectIDs; @@ -804,7 +805,7 @@ public: } } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { llwarns << "Transport error requesting object physics flags " @@ -816,7 +817,7 @@ public: clear_object_list_pending_requests(); } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if ( !content.isMap() || content.has("error") ) { @@ -873,7 +874,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return physicsFlagsResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return physicsFlagsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLPhysicsFlagsResponder"; } private: LLSD mObjectIDs; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 681cfd4fd..0b8da1053 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -219,7 +219,7 @@ public: virtual ~BaseCapabilitiesComplete() { } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL; LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); @@ -229,7 +229,7 @@ public: } } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region was removed @@ -265,7 +265,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return baseCapabilitiesComplete_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return baseCapabilitiesComplete_timeout; } + /*virtual*/ char const* getName(void) const { return "BaseCapabilitiesComplete"; } static boost::intrusive_ptr build( U64 region_handle, S32 id ) { @@ -1746,13 +1747,13 @@ public: { } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL; retry(); } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region is removed or responder is not created. @@ -1764,7 +1765,8 @@ public: regionp->setSimulatorFeatures(content); } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return simulatorFeaturesReceived_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return simulatorFeaturesReceived_timeout; } + /*virtual*/ char const* getName(void) const { return "SimulatorFeaturesReceived"; } private: void retry() diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 8a2667555..aff4334a6 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -703,18 +703,19 @@ class ViewerStatsResponder : public LLHTTPClient::ResponderWithResult public: ViewerStatsResponder() { } - void error(U32 statusNum, const std::string& reason) + /*virtual*/ void error(U32 statusNum, const std::string& reason) { llinfos << "ViewerStatsResponder::error " << statusNum << " " << reason << llendl; } - void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { llinfos << "ViewerStatsResponder::result" << llendl; } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerStatsResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerStatsResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "ViewerStatsResponder"; } }; /* diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 88b6286c7..beaddf7b1 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4420,7 +4420,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, // Center the buffer. buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f); - Dout(dc::notice, "rawSnapshot(" << image_width << ", " << image_height << ", " << snapshot_aspect << "): image_buffer_x = " << image_buffer_x << "; image_buffer_y = " << image_buffer_y); + Dout(dc::snapshot, "rawRawSnapshot(" << image_width << ", " << image_height << ", " << snapshot_aspect << "): image_buffer_x = " << image_buffer_x << "; image_buffer_y = " << image_buffer_y); bool error = !(image_buffer_x > 0 && image_buffer_y > 0); if (!error) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 55f4f656b..b0cc19cd7 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -143,8 +143,7 @@ static int scale_speaker_volume(float volume) return scaled_volume; } -class LLViewerVoiceAccountProvisionResponder : - public LLHTTPClient::ResponderWithResult +class LLViewerVoiceAccountProvisionResponder : public LLHTTPClient::ResponderWithResult { public: LLViewerVoiceAccountProvisionResponder(int retries) @@ -152,7 +151,7 @@ public: mRetries = retries; } - virtual void error(U32 status, const std::string& reason) + /*virtual*/ void error(U32 status, const std::string& reason) { if ( mRetries > 0 ) { @@ -167,7 +166,7 @@ public: } } - virtual void result(const LLSD& content) + /*virtual*/ void result(const LLSD& content) { if ( gVoiceClient ) { @@ -191,7 +190,8 @@ public: } } - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerVoiceAccountProvisionResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return viewerVoiceAccountProvisionResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLViewerVoiceAccountProvisionResponder"; } private: int mRetries; @@ -1019,9 +1019,10 @@ class LLVoiceClientCapResponder : public LLHTTPClient::ResponderWithResult public: LLVoiceClientCapResponder(void){}; - virtual void error(U32 status, const std::string& reason); // called with bad status codes - virtual void result(const LLSD& content); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceClientCapResponder_timeout; } + /*virtual*/ void error(U32 status, const std::string& reason); // called with bad status codes + /*virtual*/ void result(const LLSD& content); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceClientCapResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLVoiceClientCapResponder"; } private: }; diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 992307160..b6f8e0a65 100644 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -121,6 +121,7 @@ public: protected: /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } /*virtual*/ bool followRedir(void) const { return true; } + /*virtual*/ char const* getName(void) const { return "LLWebProfileResponders::ConfigResponder"; } private: LLPointer mImagep; @@ -156,8 +157,9 @@ public: } protected: - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } /*virtual*/ bool followRedir(void) const { return true; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } + /*virtual*/ char const* getName(void) const { return "LLWebProfileResponders::PostImageRedirectResponder"; } private: LLPointer mImagep; @@ -206,8 +208,9 @@ public: } protected: - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } /*virtual*/ bool redirect_status_ok(void) const { return true; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } + /*virtual*/ char const* getName(void) const { return "LLWebProfileResponders::PostImageResponder"; } }; /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h index af19c74b3..969e188b6 100644 --- a/indra/newview/llwlhandlers.h +++ b/indra/newview/llwlhandlers.h @@ -56,9 +56,10 @@ class LLEnvironmentRequestResponder: public LLHTTPClient::ResponderWithResult { LOG_CLASS(LLEnvironmentRequestResponder); public: - virtual void result(const LLSD& content); - virtual void error(U32 status, const std::string& reason); - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentRequestResponder_timeout; } + /*virtual*/ void result(const LLSD& content); + /*virtual*/ void error(U32 status, const std::string& reason); + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentRequestResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLEnvironmentRequestResponder"; } private: friend class LLEnvironmentRequest; @@ -80,7 +81,7 @@ private: static clock_t UPDATE_WAIT_SECONDS; }; -class LLEnvironmentApplyResponder: public LLHTTPClient::ResponderWithResult +class LLEnvironmentApplyResponder : public LLHTTPClient::ResponderWithResult { LOG_CLASS(LLEnvironmentApplyResponder); public: @@ -98,11 +99,12 @@ public: * fail_reason : string * } */ - virtual void result(const LLSD& content); + /*virtual*/ void result(const LLSD& content); - virtual void error(U32 status, const std::string& reason); // non-200 errors only + /*virtual*/ void error(U32 status, const std::string& reason); // non-200 errors only - virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentApplyResponder_timeout; } + /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentApplyResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "LLEnvironmentApplyResponder"; } private: friend class LLEnvironmentApply; diff --git a/indra/newview/llxmlrpcresponder.h b/indra/newview/llxmlrpcresponder.h index dbaa45260..25615f236 100644 --- a/indra/newview/llxmlrpcresponder.h +++ b/indra/newview/llxmlrpcresponder.h @@ -112,6 +112,7 @@ public: /*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info); /*virtual*/ void completedRaw(U32 status, std::string const& reason, LLChannelDescriptors const& channels, buffer_ptr_t const& buffer); /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return XMLRPCResponder_timeout; } + /*virtual*/ char const* getName(void) const { return "XMLRPCResponder"; } }; #endif // LLXMLRPCRESPONDER_H diff --git a/indra/newview/skins/default/xui/en-us/floater_instant_message_ad_hoc_concisebuttons.xml b/indra/newview/skins/default/xui/en-us/floater_instant_message_ad_hoc_concisebuttons.xml new file mode 100644 index 000000000..bd0208d92 --- /dev/null +++ b/indra/newview/skins/default/xui/en-us/floater_instant_message_ad_hoc_concisebuttons.xml @@ -0,0 +1,27 @@ + + + Joining Voice Chat... + Connected, click End Call to hang up + Left Voice Chat + icn_voice-groupfocus.tga + Instant Message with [NAME] + [NAME] is typing... + Starting session with [NAME], please wait. + Click here to instant message. +