Merge branch 'master' into meshupload

Conflicts:
	indra/newview/llmeshrepository.cpp

Added /* */ around the 'virtual' keyword in two places
that collided with changes in meshupload from lightdrake.
This commit is contained in:
Aleric Inglewood
2013-01-13 17:59:49 +01:00
73 changed files with 1221 additions and 819 deletions

View File

@@ -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 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 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 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 dc
} // namespace DEBUGCHANNELS } // namespace DEBUGCHANNELS

View File

@@ -208,6 +208,7 @@ extern CWD_API channel_ct caps;
extern CWD_API channel_ct curl; extern CWD_API channel_ct curl;
extern CWD_API channel_ct curlio; extern CWD_API channel_ct curlio;
extern CWD_API channel_ct curltr; extern CWD_API channel_ct curltr;
extern CWD_API channel_ct snapshot;
#endif #endif

View File

@@ -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(int y,) int z);
// void foo(x/*,*/ ASSERT_ONLY_COMMA(int y)); // The optional /*,*/ makes it just a bit better readable. // void foo(x/*,*/ ASSERT_ONLY_COMMA(int y)); // The optional /*,*/ makes it just a bit better readable.
#ifdef SHOW_ASSERT #ifdef SHOW_ASSERT
#define ASSERT_ONLY(type_param,...) type_param,##__VA_ARGS__ #define ASSERT_ONLY(...) __VA_ARGS__
#define ASSERT_ONLY_COMMA(type_param,...) , type_param,##__VA_ARGS__ #define ASSERT_ONLY_COMMA(...) , __VA_ARGS__
#else #else
#define ASSERT_ONLY(type_param,...) #define ASSERT_ONLY(...)
#define ASSERT_ONLY_COMMA(type_param,...) #define ASSERT_ONLY_COMMA(...)
#endif #endif
// handy compile-time assert - enforce those template parameters! // handy compile-time assert - enforce those template parameters!

View File

@@ -60,22 +60,23 @@ extern AIHTTPTimeoutPolicy crashLoggerResponder_timeout;
class LLCrashLoggerResponder : public LLHTTPClient::ResponderWithResult class LLCrashLoggerResponder : public LLHTTPClient::ResponderWithResult
{ {
public: public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return crashLoggerResponder_timeout; }
LLCrashLoggerResponder() LLCrashLoggerResponder()
{ {
} }
virtual void error(U32 status, const std::string& reason) /*virtual*/ void error(U32 status, const std::string& reason)
{ {
gBreak = true; gBreak = true;
} }
virtual void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
gBreak = true; gBreak = true;
gSent = true; gSent = true;
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return crashLoggerResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLCrashLoggerResponder"; }
}; };
bool LLCrashLoggerText::mainLoop() bool LLCrashLoggerText::mainLoop()

View File

@@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES
aicurlperhost.cpp aicurlperhost.cpp
aicurlthread.cpp aicurlthread.cpp
aihttpheaders.cpp aihttpheaders.cpp
aihttptimeout.cpp
aihttptimeoutpolicy.cpp aihttptimeoutpolicy.cpp
debug_libcurl.cpp debug_libcurl.cpp
llhttpclient.cpp llhttpclient.cpp
@@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES
aicurlperhost.h aicurlperhost.h
aicurlthread.h aicurlthread.h
aihttpheaders.h aihttpheaders.h
aihttptimeout.h
aihttptimeoutpolicy.h aihttptimeoutpolicy.h
debug_libcurl.h debug_libcurl.h
llares.h llares.h

View File

@@ -1276,7 +1276,7 @@ static int const HTTP_REDIRECTS_DEFAULT = 10;
LLChannelDescriptors const BufferedCurlEasyRequest::sChannels; 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++; AICurlInterface::Stats::BufferedCurlEasyRequest_count++;
} }
@@ -1336,8 +1336,13 @@ void BufferedCurlEasyRequest::resetState(void)
// Call base class implementation. // Call base class implementation.
CurlEasyRequest::resetState(); CurlEasyRequest::resetState();
// Reset local variables.
mOutput.reset(); mOutput.reset();
mInput.reset(); mInput.reset();
mRequestTransferedBytes = 0;
mResponseTransferedBytes = 0;
mBufferEventsTarget = NULL;
mStatus = HTTP_INTERNAL_ERROR;
} }
void BufferedCurlEasyRequest::print_diagnostics(CURLcode code) void BufferedCurlEasyRequest::print_diagnostics(CURLcode code)

View File

@@ -35,82 +35,15 @@
#include "llatomic.h" #include "llatomic.h"
#include "llrefcount.h" #include "llrefcount.h"
#include "aicurlperhost.h" #include "aicurlperhost.h"
#include "aihttptimeout.h"
class AIHTTPHeaders; class AIHTTPHeaders;
class AIHTTPTimeoutPolicy;
class AICurlEasyRequest;
class AICurlEasyRequestStateMachine; class AICurlEasyRequestStateMachine;
namespace AICurlPrivate { namespace AICurlPrivate {
class CurlEasyRequest;
class ThreadSafeBufferedCurlEasyRequest;
namespace curlthread { namespace curlthread {
class MultiHandle; 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<U32> 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 } // namespace curlthread
void handle_multi_error(CURLMcode code); void handle_multi_error(CURLMcode code);
@@ -498,6 +431,9 @@ class BufferedCurlEasyRequest : public CurlEasyRequest {
// Return pointer to the ThreadSafe (wrapped) version of this object. // Return pointer to the ThreadSafe (wrapped) version of this object.
ThreadSafeBufferedCurlEasyRequest* get_lockobj(void); ThreadSafeBufferedCurlEasyRequest* get_lockobj(void);
ThreadSafeBufferedCurlEasyRequest const* get_lockobj(void) const; 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 // Return true when prepRequest was already called and the object has not been
// invalidated as a result of calling timed_out(). // invalidated as a result of calling timed_out().

View File

@@ -31,6 +31,7 @@
#include "linden_common.h" #include "linden_common.h"
#include "aicurlthread.h" #include "aicurlthread.h"
#include "aihttptimeoutpolicy.h" #include "aihttptimeoutpolicy.h"
#include "aihttptimeout.h"
#include "aicurlperhost.h" #include "aicurlperhost.h"
#include "lltimer.h" // ms_sleep, get_clock_count #include "lltimer.h" // ms_sleep, get_clock_count
#include "llhttpstatuscodes.h" #include "llhttpstatuscodes.h"
@@ -353,8 +354,8 @@ class PollSet
#if !WINDOWS_CODE #if !WINDOWS_CODE
curl_socket_t mMaxFd; // The largest filedescriptor in the array, or CURL_SOCKET_BAD when it is empty. curl_socket_t mMaxFd; // The largest filedescriptor in the array, or CURL_SOCKET_BAD when it is empty.
curl_socket_t mMaxFdSet; // The largest filedescriptor set in mFdSet by refresh(), or CURL_SOCKET_BAD when it was empty. curl_socket_t mMaxFdSet; // The largest filedescriptor set in mFdSet by refresh(), or CURL_SOCKET_BAD when it was empty.
std::vector<CurlSocketInfo*> mCopiedFileDescriptors; // Filedescriptors copied by refresh to mFdSet. std::vector<curl_socket_t> mCopiedFileDescriptors; // Filedescriptors copied by refresh to mFdSet.
std::vector<CurlSocketInfo*>::iterator mIter; // Index into mCopiedFileDescriptors for next(); loop variable. std::vector<curl_socket_t>::iterator mIter; // Index into mCopiedFileDescriptors for next(); loop variable.
#else #else
unsigned int mIter; // Index into fd_set::fd_array. unsigned int mIter; // Index into fd_set::fd_array.
#endif #endif
@@ -580,14 +581,14 @@ refresh_t PollSet::refresh(void)
} }
FD_SET(mFileDescriptors[i]->getSocketFd(), &mFdSet); FD_SET(mFileDescriptors[i]->getSocketFd(), &mFdSet);
#if !WINDOWS_CODE #if !WINDOWS_CODE
mCopiedFileDescriptors.push_back(mFileDescriptors[i]); mCopiedFileDescriptors.push_back(mFileDescriptors[i]->getSocketFd());
#endif #endif
if (++i == mNrFds) if (++i == mNrFds)
{ {
// If we reached the end and start at the beginning, then we copied everything. // If we reached the end and start at the beginning, then we copied everything.
if (mNext == 0) if (mNext == 0)
break; 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. // wrap around and terminate on count reaching FD_SETSIZE.
i = 0; i = 0;
} }
@@ -625,7 +626,7 @@ void PollSet::reset(void)
else else
{ {
mIter = mCopiedFileDescriptors.begin(); mIter = mCopiedFileDescriptors.begin();
if (!FD_ISSET((*mIter)->getSocketFd(), &mFdSet)) if (!FD_ISSET(*mIter, &mFdSet))
next(); next();
} }
#endif #endif
@@ -636,7 +637,7 @@ inline curl_socket_t PollSet::get(void) const
#if WINDOWS_CODE #if WINDOWS_CODE
return (mIter >= mFdSet.fd_count) ? CURL_SOCKET_BAD : mFdSet.fd_array[mIter]; return (mIter >= mFdSet.fd_count) ? CURL_SOCKET_BAD : mFdSet.fd_array[mIter];
#else #else
return (mIter == mCopiedFileDescriptors.end()) ? CURL_SOCKET_BAD : (*mIter)->getSocketFd(); return (mIter == mCopiedFileDescriptors.end()) ? CURL_SOCKET_BAD : *mIter;
#endif #endif
} }
@@ -647,7 +648,7 @@ void PollSet::next(void)
++mIter; ++mIter;
#else #else
llassert(mIter != mCopiedFileDescriptors.end()); // Only call next() if the last call to get() didn't return -1. llassert(mIter != mCopiedFileDescriptors.end()); // Only call next() if the last call to get() didn't return -1.
while (++mIter != mCopiedFileDescriptors.end() && !FD_ISSET((*mIter)->getSocketFd(), &mFdSet)); while (++mIter != mCopiedFileDescriptors.end() && !FD_ISSET(*mIter, &mFdSet));
#endif #endif
} }
@@ -1307,28 +1308,7 @@ void AICurlThread::run(void)
{ {
// If mRunning is true then we can only get here if mWakeUpFd != CURL_SOCKET_BAD. // If mRunning is true then we can only get here if mWakeUpFd != CURL_SOCKET_BAD.
llassert(mWakeUpFd != CURL_SOCKET_BAD); llassert(mWakeUpFd != CURL_SOCKET_BAD);
// Copy the next batch of file descriptors from the PollSets mFileDescriptors into their mFdSet. // Process every command in command_queue before filling the fd_set passed to select().
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().
for(;;) for(;;)
{ {
mWakeUpMutex.lock(); mWakeUpMutex.lock();
@@ -1346,9 +1326,32 @@ void AICurlThread::run(void)
mWakeUpMutex.unlock(); mWakeUpMutex.unlock();
break; break;
} }
// If we get here then mWakeUpFlag has been false since we grabbed the lock. // 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 // 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. // 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; struct timeval timeout;
long timeout_ms = multi_handle_w->getTimeout(); long timeout_ms = multi_handle_w->getTimeout();
// If no timeout is set, sleep 1 second. // If no timeout is set, sleep 1 second.
@@ -1575,7 +1578,7 @@ int MultiHandle::socket_callback(CURL* easy, curl_socket_t s, int action, void*
ThreadSafeBufferedCurlEasyRequest* ptr; ThreadSafeBufferedCurlEasyRequest* ptr;
CURLcode rese = curl_easy_getinfo(easy, CURLINFO_PRIVATE, &ptr); CURLcode rese = curl_easy_getinfo(easy, CURLINFO_PRIVATE, &ptr);
llassert_always(rese == CURLE_OK); llassert_always(rese == CURLE_OK);
sock_info = new CurlSocketInfo(self, easy, s, action, ptr); sock_info = new CurlSocketInfo(self, ASSERT_ONLY(easy,) s, action, ptr);
} }
else else
{ {
@@ -1807,383 +1810,6 @@ void MultiHandle::finish_easy_request(AICurlEasyRequest const& easy_request, CUR
curl_easy_request_w->done(curl_easy_request_w, result); 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 curlthread
} // namespace AICurlPrivate } // namespace AICurlPrivate
@@ -2395,23 +2021,18 @@ size_t BufferedCurlEasyRequest::curlHeaderCallback(char* data, size_t size, size
char const* const header_line = static_cast<char const*>(data); char const* const header_line = static_cast<char const*>(data);
size_t const header_len = size * nmemb; 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) if (!header_len)
{ {
return header_len; return header_len;
} }
std::string header(header_line, header_len); std::string header(header_line, header_len);
bool done = false;
if (!LLStringUtil::_isASCII(header)) if (!LLStringUtil::_isASCII(header))
{ {
return header_len; done = true;
} }
// Per HTTP spec the first header line must be the status line. // 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 begin = header.begin();
std::string::iterator const end = header.end(); 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->received_HTTP_header();
self_w->setStatusAndReason(status, reason); 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; return header_len;
} }

View File

@@ -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 <http://www.gnu.org/licenses/>.
*
* 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 <iostream>
#include <cassert>
#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<typename T>
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

View File

@@ -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 <http://www.gnu.org/licenses/>.
*
* 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 <vector>
#ifndef HTTPTIMEOUT_TESTSUITE
#include "llrefcount.h"
#include "aithreadsafe.h" // AIAccess
#include <curl/curl.h> // Needed for files that include this header (also for aicurlprivate.h).
#ifdef DEBUG_CURLIO
#include "debug_libcurl.h"
#endif
#else
#include <sys/types.h>
class LLRefCount { };
template<typename T> 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<AICurlPrivate::BufferedCurlEasyRequest> 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<U32> 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

View File

@@ -188,8 +188,6 @@ private:
virtual bool needsHeaders(void) const { return true; } virtual bool needsHeaders(void) const { return true; }
public: public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarNameResponder_timeout; }
LLAvatarNameResponder(const std::vector<LLUUID>& agent_ids) LLAvatarNameResponder(const std::vector<LLUUID>& agent_ids)
: mAgentIDs(agent_ids) : mAgentIDs(agent_ids)
{ } { }
@@ -271,6 +269,9 @@ public:
LLAvatarNameCache::handleAgentError(agent_id); 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 // Provide some fallback for agents that return errors

View File

@@ -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) std::string const& LLHTTPClient::ResponderBase::get_cookie(std::string const& key)
{ {
AIHTTPReceivedHeaders::range_type cookies; AIHTTPReceivedHeaders::range_type cookies;
mReceivedHeaders.getValues("set-cookie", cookies); if (mReceivedHeaders.getValues("set-cookie", cookies))
for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie)
{ {
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. // Not found.
@@ -533,16 +535,19 @@ protected:
class BlockingLLSDPostResponder : public BlockingLLSDResponder { class BlockingLLSDPostResponder : public BlockingLLSDResponder {
public: public:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDPost_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDPost_timeout; }
/*virtual*/ char const* getName(void) const { return "BlockingLLSDPostResponder"; }
}; };
class BlockingLLSDGetResponder : public BlockingLLSDResponder { class BlockingLLSDGetResponder : public BlockingLLSDResponder {
public: public:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDGet_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingLLSDGet_timeout; }
/*virtual*/ char const* getName(void) const { return "BlockingLLSDGetResponder"; }
}; };
class BlockingRawGetResponder : public BlockingRawResponder { class BlockingRawGetResponder : public BlockingRawResponder {
public: public:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingRawGet_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return blockingRawGet_timeout; }
/*virtual*/ char const* getName(void) const { return "BlockingRawGetResponder"; }
}; };
// End (blocking) responders. // End (blocking) responders.

View File

@@ -158,10 +158,12 @@ public:
// Erase all headers EXCEPT the cookies. // Erase all headers EXCEPT the cookies.
AIHTTPReceivedHeaders set_cookie_headers; AIHTTPReceivedHeaders set_cookie_headers;
AIHTTPReceivedHeaders::range_type cookies; AIHTTPReceivedHeaders::range_type cookies;
mReceivedHeaders.getValues("set-cookie", cookies); if (mReceivedHeaders.getValues("set-cookie", cookies))
for (AIHTTPReceivedHeaders::iterator_type cookie = cookies.first; cookie != cookies.second; ++cookie)
{ {
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. // Replace headers with just the cookie headers.
mReceivedHeaders.swap(set_cookie_headers); mReceivedHeaders.swap(set_cookie_headers);
@@ -196,6 +198,9 @@ public:
// Timeout policy to use. // Timeout policy to use.
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const = 0; 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: protected:
// Derived classes can override this to get the HTML headers that were received, when the message is completed. // 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. // Only actually called for classes that implement a needsHeaders() that returns true.
@@ -378,6 +383,7 @@ public:
*/ */
class ResponderIgnore : public ResponderIgnoreBody { class ResponderIgnore : public ResponderIgnoreBody {
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return responderIgnore_timeout;} /*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 // A Responder is passed around as ResponderPtr, which causes it to automatically

View File

@@ -136,8 +136,6 @@ private:
class EventResponder: public LLHTTPClient::ResponderWithResult class EventResponder: public LLHTTPClient::ResponderWithResult
{ {
public: public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return *mHTTPTimeoutPolicy; }
/** /**
* LLHTTPClient::ResponderWithResult that dispatches via named LLEventPump instances. * LLHTTPClient::ResponderWithResult that dispatches via named LLEventPump instances.
* We bind LLEventPumps, even though it's an LLSingleton, for testability. * We bind LLEventPumps, even though it's an LLSingleton, for testability.
@@ -158,9 +156,12 @@ private:
void setTimeoutPolicy(std::string const& name); void setTimeoutPolicy(std::string const& name);
virtual void result(const LLSD& data); /*virtual*/ void result(const LLSD& data);
virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content); /*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: private:
LLEventPumps& mPumps; LLEventPumps& mPumps;
LLReqID mReqID; LLReqID mReqID;

View File

@@ -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 // don't spam when agent communication disconnected already
if (status != 410) if (status != 410)
@@ -131,12 +131,13 @@ namespace
if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT); 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); 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: private:

View File

@@ -1185,7 +1185,7 @@ void LLView::drawChildren()
{ {
// Only draw views that are within the root view // Only draw views that are within the root view
LLRect screen_rect = viewp->calcScreenRect(); LLRect screen_rect = viewp->calcScreenRect();
if ( rootp->getLocalRect().overlaps(screen_rect) ) if ( rootp->getRect().overlaps(screen_rect) )
{ {
//gGL.matrixMode(LLRender::MM_MODELVIEW); //gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix(); LLUI::pushMatrix();

View File

@@ -85,13 +85,13 @@ class LLIamHereVoice : public LLHTTPClient::ResponderWithResult
mParent = parentIn; mParent = parentIn;
}; };
virtual void result( const LLSD& content ) /*virtual*/ void result( const LLSD& content )
{ {
if ( mParent ) if ( mParent )
mParent->setSiteIsAlive( true ); mParent->setSiteIsAlive( true );
}; };
virtual void error( U32 status, const std::string& reason ) /*virtual*/ void error( U32 status, const std::string& reason )
{ {
if ( mParent ) 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 // this is global and not a class member to keep crud out of the header file

View File

@@ -301,7 +301,9 @@ void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected)
break;*/ break;*/
} }
} }
/*struct InventoryImportInfo
#if 0
struct InventoryImportInfo
{ {
U32 localid; U32 localid;
LLAssetType::EType type; LLAssetType::EType type;
@@ -372,7 +374,7 @@ public:
{ {
} }
virtual void uploadComplete(const LLSD& content) /*virtual*/ void uploadComplete(const LLSD& content)
{ {
LLPointer<LLInventoryCallback> cb = new JCImportTransferCallback(data); LLPointer<LLInventoryCallback> cb = new JCImportTransferCallback(data);
LLPermissions perm; LLPermissions perm;
@@ -385,6 +387,7 @@ public:
cb); cb);
} }
/*virtual*/ char const* getName(void) const { return "JCImportInventoryResponder"; }
private: private:
InventoryImportInfo* data; InventoryImportInfo* data;
}; };
@@ -405,13 +408,14 @@ public:
LLAssetType::EType asset_type) : LLAssetUploadResponder(post_data, file_name, asset_type) 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"); //cmdline_printchat("completed upload, inserting");
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id); LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id);
LLViewerObject* objectp = find(data->localid); LLViewerObject* objectp = find(data->localid);
insert(item, objectp, data); insert(item, objectp, data);
} }
/*virtual*/ char const* getName(void) const { return "JCPostInvUploadResponder"; }
private: private:
LLUUID item_id; LLUUID item_id;
InventoryImportInfo* data; InventoryImportInfo* data;
@@ -1119,4 +1123,4 @@ void ImportTracker::plywood_above_head()
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null); msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
msg->sendReliable(region->getHost()); msg->sendReliable(region->getHost());
} }
*/ #endif

View File

@@ -57,12 +57,13 @@ class EmeraldDicDownloader : public LLHTTPClient::ResponderWithCompleted
public: public:
EmeraldDicDownloader(lggDicDownloadFloater* spanel, std::string sname); EmeraldDicDownloader(lggDicDownloadFloater* spanel, std::string sname);
~EmeraldDicDownloader() { } ~EmeraldDicDownloader() { }
void completedRaw( /*virtual*/ void completedRaw(
U32 status, U32 status,
const std::string& reason, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const buffer_ptr_t& buffer); 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: private:
lggDicDownloadFloater* panel; lggDicDownloadFloater* panel;
std::string name; std::string name;

View File

@@ -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 "<<reason<<llendl; llwarns << "Transport error "<<reason<<llendl;
clearPendingRequests(); clearPendingRequests();
} }
void result( const LLSD& content ) /*virtual*/ void result( const LLSD& content )
{ {
//Check for error //Check for error
if ( !content.isMap() || content.has("error") ) if ( !content.isMap() || content.has("error") )
@@ -88,12 +88,14 @@ public:
clearPendingRequests(); clearPendingRequests();
} }
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return accountingCostResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return accountingCostResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLAccountingCostResponder"; }
private: private:
//List of posted objects //List of posted objects
LLSD mObjectIDs; LLSD mObjectIDs;
}; };
//=============================================================================== //===============================================================================
void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, const std::string& url ) void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, const std::string& url )
{ {

View File

@@ -2512,10 +2512,11 @@ public:
LLMaturityPreferencesResponder(LLAgent *pAgent, U8 pPreferredMaturity, U8 pPreviousMaturity); LLMaturityPreferencesResponder(LLAgent *pAgent, U8 pPreferredMaturity, U8 pPreviousMaturity);
virtual ~LLMaturityPreferencesResponder(); virtual ~LLMaturityPreferencesResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*virtual*/ void error(U32 pStatus, const std::string& pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return maturityPreferences_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return maturityPreferences_timeout; }
/*virtual*/ char const* getName(void) const { return "LLMaturityPreferencesResponder"; }
private: private:
U8 parseMaturityFromServerResponse(const LLSD &pContent); U8 parseMaturityFromServerResponse(const LLSD &pContent);

View File

@@ -75,7 +75,7 @@ public:
delete mData; delete mData;
} }
virtual void error(U32 statusNum, const std::string& reason) /*virtual*/ void error(U32 statusNum, const std::string& reason)
{ {
llwarns << "Error: " << reason << llendl; llwarns << "Error: " << reason << llendl;
LLUpdateTaskInventoryResponder::error(statusNum, reason); LLUpdateTaskInventoryResponder::error(statusNum, reason);
@@ -86,7 +86,7 @@ public:
} }
} }
virtual void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
LLUpdateTaskInventoryResponder::result(content); LLUpdateTaskInventoryResponder::result(content);
LLAssetUploadQueue *queue = mSupplier->get(); LLAssetUploadQueue *queue = mSupplier->get();
@@ -136,13 +136,14 @@ public:
LLUpdateTaskInventoryResponder::uploadComplete(content); LLUpdateTaskInventoryResponder::uploadComplete(content);
} }
/*virtual*/ char const* getName(void) const { return "LLAssetUploadChainResponder"; }
LLAssetUploadQueueSupplier *mSupplier; LLAssetUploadQueueSupplier *mSupplier;
char* mData; char* mData;
U32 mDataSize; U32 mDataSize;
std::string mScriptName; std::string mScriptName;
}; };
LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) : LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) :
mSupplier(supplier) mSupplier(supplier)
{ {

View File

@@ -317,8 +317,10 @@ void LLAssetUploadResponder::uploadComplete(const LLSD& content)
LLNewAgentInventoryResponder::LLNewAgentInventoryResponder( LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(
const LLSD& post_data, const LLSD& post_data,
const LLUUID& vfile_id, const LLUUID& vfile_id,
LLAssetType::EType asset_type) LLAssetType::EType asset_type,
: LLAssetUploadResponder(post_data, vfile_id, 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 LLSD& post_data,
const std::string& file_name, const std::string& file_name,
LLAssetType::EType asset_type) LLAssetType::EType asset_type)
: LLAssetUploadResponder(post_data, file_name, asset_type) : LLAssetUploadResponder(post_data, file_name, asset_type), mCallBack(NULL), mUserData(NULL)
{ {
} }
// virtual // virtual
void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reason) void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reason)
{ {
if (mCallBack)
{
(*mCallBack)(false, mUserData);
}
LLAssetUploadResponder::error(statusNum, reason); LLAssetUploadResponder::error(statusNum, reason);
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE);
} }
@@ -340,6 +346,10 @@ void LLNewAgentInventoryResponder::error(U32 statusNum, const std::string& reaso
//virtual //virtual
void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content) void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content)
{ {
if (mCallBack)
{
(*mCallBack)(false, mUserData);
}
LLAssetUploadResponder::uploadFailure(content); LLAssetUploadResponder::uploadFailure(content);
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE); //LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], FALSE);
} }
@@ -349,6 +359,11 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
{ {
lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl;
if (mCallBack)
{
(*mCallBack)(true, mUserData);
}
//std::ostringstream llsdxml; //std::ostringstream llsdxml;
//LLSDSerialize::toXML(content, llsdxml); //LLSDSerialize::toXML(content, llsdxml);
//llinfos << "upload complete content:\n " << llsdxml.str() << llendl; //llinfos << "upload complete content:\n " << llsdxml.str() << llendl;

View File

@@ -61,9 +61,10 @@ public:
const std::string& file_name, const std::string& file_name,
LLAssetType::EType asset_type); LLAssetType::EType asset_type);
~LLAssetUploadResponder(); ~LLAssetUploadResponder();
virtual void error(U32 statusNum, const std::string& reason); /*virtual*/ void error(U32 statusNum, const std::string& reason);
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return assetUploadResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return assetUploadResponder_timeout; }
virtual void uploadUpload(const LLSD& content); virtual void uploadUpload(const LLSD& content);
virtual void uploadComplete(const LLSD& content); virtual void uploadComplete(const LLSD& content);
virtual void uploadFailure(const LLSD& content); virtual void uploadFailure(const LLSD& content);
@@ -77,18 +78,23 @@ protected:
class LLNewAgentInventoryResponder : public LLAssetUploadResponder class LLNewAgentInventoryResponder : public LLAssetUploadResponder
{ {
void (*mCallBack)(bool, void*);
void* mUserData;
public: public:
LLNewAgentInventoryResponder( LLNewAgentInventoryResponder(
const LLSD& post_data, const LLSD& post_data,
const LLUUID& vfile_id, const LLUUID& vfile_id,
LLAssetType::EType asset_type); LLAssetType::EType asset_type,
void (*callback)(bool, void*) = NULL,
void* user_data = NULL);
LLNewAgentInventoryResponder( LLNewAgentInventoryResponder(
const LLSD& post_data, const LLSD& post_data,
const std::string& file_name, const std::string& file_name,
LLAssetType::EType asset_type); 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 uploadComplete(const LLSD& content);
virtual void uploadFailure(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 // A base class which goes through and performs some default
@@ -110,12 +116,12 @@ public:
const LLSD& inventory_info); const LLSD& inventory_info);
virtual ~LLNewAgentInventoryVariablePriceResponder(); virtual ~LLNewAgentInventoryVariablePriceResponder();
void errorWithContent( /*virtual*/ void errorWithContent(
U32 statusNum, U32 statusNum,
const std::string& reason, const std::string& reason,
const LLSD& content); const LLSD& content);
void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return newAgentInventoryVariablePriceResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return newAgentInventoryVariablePriceResponder_timeout; }
virtual void onApplicationLevelError( virtual void onApplicationLevelError(
const LLSD& error); const LLSD& error);
@@ -141,8 +147,9 @@ public:
~LLSendTexLayerResponder(); ~LLSendTexLayerResponder();
virtual void uploadComplete(const LLSD& content); /*virtual*/ void uploadComplete(const LLSD& content);
virtual void error(U32 statusNum, const std::string& reason); /*virtual*/ void error(U32 statusNum, const std::string& reason);
/*virtual*/ char const* getName(void) const { return "LLSendTexLayerResponder"; }
LLBakedUploadData * mBakedUploadData; LLBakedUploadData * mBakedUploadData;
}; };
@@ -157,6 +164,7 @@ public:
const std::string& file_name, const std::string& file_name,
LLAssetType::EType asset_type); LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content); virtual void uploadComplete(const LLSD& content);
/*virtual*/ char const* getName(void) const { return "LLUpdateAgentInventoryResponder"; }
}; };
class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder class LLUpdateTaskInventoryResponder : public LLAssetUploadResponder
@@ -174,7 +182,8 @@ public:
LLAssetType::EType asset_type); LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content); virtual void uploadComplete(const LLSD& content);
/*virtual*/ char const* getName(void) const { return "LLUpdateTaskInventoryResponder"; }
private: private:
LLUUID mQueueId; LLUUID mQueueId;
}; };

View File

@@ -45,10 +45,11 @@ class LLClassifiedStatsResponder : public LLHTTPClient::ResponderWithResult
public: public:
LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id); LLClassifiedStatsResponder(LLHandle<LLView> classified_panel_handle, LLUUID classified_id);
//If we get back a normal response, handle it here //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 //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);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return classifiedStatsResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return classifiedStatsResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLClassifiedStatsResponder"; }
protected: protected:
LLHandle<LLView> mClassifiedPanelHandle; LLHandle<LLView> mClassifiedPanelHandle;

View File

@@ -73,9 +73,10 @@ namespace
void handleMessage(const LLSD& content); void handleMessage(const LLSD& content);
virtual void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return eventPollResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return eventPollResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLEventPollResponder"; }
private: private:

View File

@@ -832,7 +832,7 @@ void LLPanelActiveSpeakers::onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data
mSessionID = session_id; 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; 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: private:
LLUUID mSessionID; LLUUID mSessionID;
@@ -899,7 +900,7 @@ void LLPanelActiveSpeakers::onModeratorMuteText(LLUICtrl* ctrl, void* user_data)
mSessionID = session_id; 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; 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: private:
LLUUID mSessionID; LLUUID mSessionID;
@@ -967,11 +969,12 @@ void LLPanelActiveSpeakers::onChangeModerationMode(LLUICtrl* ctrl, void* user_da
struct ModerationModeResponder : public LLHTTPClient::ResponderIgnoreBody 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; 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()); LLHTTPClient::post(url, data, new ModerationModeResponder());

View File

@@ -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() void LLFloaterAvatarPicker::find()

View File

@@ -43,6 +43,7 @@
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llwebprofile.h" #include "llwebprofile.h"
#include "lluploaddialog.h" #include "lluploaddialog.h"
#include "lltexteditor.h"
#include <boost/bind.hpp> #include <boost/bind.hpp>
@@ -52,7 +53,7 @@
LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) : LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) :
LLFloater(std::string("Feed Floater")), 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<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this)); getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this));
getChild<LLUICtrl>("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this)); getChild<LLUICtrl>("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this));
LLTextEditor* caption = getChild<LLTextEditor>("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; return true;
} }
void LLFloaterFeed::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption)
{
if (caption && caption == receiver && caption->hasFocus() && !mHasFirstMsgFocus)
{
mHasFirstMsgFocus = true;
caption->setText(LLStringUtil::null);
}
}
// static // static
LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, int index) 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() 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()) if (mPNGImage.notNull())
{ {
static LLCachedControl<bool> add_location("SnapshotFeedAddLocation"); static LLCachedControl<bool> add_location("SnapshotFeedAddLocation");

View File

@@ -38,6 +38,8 @@
class LLImagePNG; class LLImagePNG;
class LLViewerTexture; class LLViewerTexture;
class LLFocusableElement;
class LLTextEditor;
class LLFloaterFeed : public LLFloater class LLFloaterFeed : public LLFloater
{ {
@@ -53,12 +55,14 @@ public:
void onClickCancel(); void onClickCancel();
void onClickPost(); void onClickPost();
void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption);
protected: protected:
LLPointer<LLImagePNG> mPNGImage; LLPointer<LLImagePNG> mPNGImage;
LLPointer<LLViewerTexture> mViewerImage; LLPointer<LLViewerTexture> mViewerImage;
LLVector2 const mImageScale; LLVector2 const mImageScale;
int mSnapshotIndex; int mSnapshotIndex;
bool mHasFirstMsgFocus;
}; };
#endif // LL_LLFLOATERFEED_H #endif // LL_LLFLOATERFEED_H

View File

@@ -251,7 +251,6 @@ public:
/*virtual*/ void uploadComplete(const LLSD& content) /*virtual*/ void uploadComplete(const LLSD& content)
{ {
// we don't care about what the server returns from this post, just clean up the UI // we don't care about what the server returns from this post, just clean up the UI
LLUploadDialog::modalUploadFinished();
LLFloaterSnapshot::savePostcardDone(true, mSnapshotIndex); LLFloaterSnapshot::savePostcardDone(true, mSnapshotIndex);
} }
/*virtual*/ void uploadFailure(const LLSD& content) /*virtual*/ void uploadFailure(const LLSD& content)
@@ -264,6 +263,7 @@ public:
LLAssetUploadResponder::error(statusNum, reason); LLAssetUploadResponder::error(statusNum, reason);
LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex); LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex);
} }
/*virtual*/ char const* getName(void) const { return "LLSendPostcardResponder"; }
}; };
// static // static
@@ -313,8 +313,6 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
{ {
LLFloaterPostcard *self = (LLFloaterPostcard *)user_data; LLFloaterPostcard *self = (LLFloaterPostcard *)user_data;
LLUploadDialog::modalUploadFinished();
LLFloaterSnapshot::savePostcardDone(!result, self->mSnapshotIndex); LLFloaterSnapshot::savePostcardDone(!result, self->mSnapshotIndex);
if (result) if (result)
@@ -345,7 +343,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
gAgent.sendReliableMessage(); gAgent.sendReliableMessage();
} }
self->close(); self->destroy();
} }
// static // static

View File

@@ -80,12 +80,9 @@ namespace
class AsyncConsoleResponder : public LLHTTPClient::ResponderIgnoreBody class AsyncConsoleResponder : public LLHTTPClient::ResponderIgnoreBody
{ {
public: public:
/* virtual */ /*virtual*/ void error(U32 status, const std::string& reason) { sConsoleReplySignal(UNABLE_TO_SEND_COMMAND); }
void error(U32 status, const std::string& reason) /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; }
{ /*virtual*/ char const* getName(void) const { return "AsyncConsoleResponder"; }
sConsoleReplySignal(UNABLE_TO_SEND_COMMAND);
}
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return asyncConsoleResponder_timeout; }
}; };
class ConsoleResponder : public LLHTTPClient::ResponderWithResult class ConsoleResponder : public LLHTTPClient::ResponderWithResult
@@ -95,8 +92,7 @@ namespace
{ {
} }
/*virtual*/ /*virtual*/ void error(U32 status, const std::string& reason)
void error(U32 status, const std::string& reason)
{ {
if (mOutput) if (mOutput)
{ {
@@ -106,8 +102,7 @@ namespace
} }
} }
/*virtual*/ /*virtual*/ void result(const LLSD& content)
void result(const LLSD& content)
{ {
if (mOutput) 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; LLTextEditor * mOutput;
}; };

View File

@@ -2326,7 +2326,7 @@ public:
} }
// if we get a normal response, handle it here // 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; LL_INFOS("Windlight") << "Successfully committed estate info" << llendl;
@@ -2337,13 +2337,14 @@ public:
} }
// if we get an error response // 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 " llinfos << "LLEstateChangeInfoResponder::error "
<< status << ": " << reason << llendl; << 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: private:
LLHandle<LLPanel> mpPanel; LLHandle<LLPanel> mpPanel;

View File

@@ -843,7 +843,7 @@ public:
LLUserReportScreenshotResponder(const LLSD & post_data, LLUserReportScreenshotResponder(const LLSD & post_data,
const LLUUID & vfile_id, const LLUUID & vfile_id,
LLAssetType::EType asset_type): LLAssetType::EType asset_type):
LLAssetUploadResponder(post_data, vfile_id, asset_type) LLAssetUploadResponder(post_data, vfile_id, asset_type)
{ {
} }
void uploadFailed(const LLSD& content) 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 // we don't care about what the server returns from this post, just clean up the UI
LLUploadDialog::modalUploadFinished(); LLUploadDialog::modalUploadFinished();
} }
/*virtual*/ char const* getName(void) const { return "LLUserReportScreenshotResponder"; }
}; };
class LLUserReportResponder : public LLHTTPClient::ResponderWithResult class LLUserReportResponder : public LLHTTPClient::ResponderWithResult
@@ -863,17 +865,18 @@ class LLUserReportResponder : public LLHTTPClient::ResponderWithResult
public: public:
LLUserReportResponder() { } LLUserReportResponder() { }
void error(U32 status, const std::string& reason) /*virtual*/ void error(U32 status, const std::string& reason)
{ {
// *TODO do some user messaging here // *TODO do some user messaging here
LLUploadDialog::modalUploadFinished(); LLUploadDialog::modalUploadFinished();
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
// we don't care about what the server returns // we don't care about what the server returns
LLUploadDialog::modalUploadFinished(); 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) void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url, const LLSD& report)

View File

@@ -64,6 +64,7 @@
#include "llviewerwindow.h" #include "llviewerwindow.h"
#include "llwindow.h" #include "llwindow.h"
#include "llviewermenufile.h" // upload_new_resource() #include "llviewermenufile.h" // upload_new_resource()
#include "llresourcedata.h"
#include "llfloaterpostcard.h" #include "llfloaterpostcard.h"
#include "llfloaterfeed.h" #include "llfloaterfeed.h"
#include "llcheckboxctrl.h" #include "llcheckboxctrl.h"
@@ -73,6 +74,7 @@
#include "llworld.h" #include "llworld.h"
#include "llagentui.h" #include "llagentui.h"
#include "llvoavatar.h" #include "llvoavatar.h"
#include "lluploaddialog.h"
#include "llgl.h" #include "llgl.h"
#include "llglheaders.h" #include "llglheaders.h"
@@ -182,6 +184,7 @@ public:
LLFloaterPostcard* savePostcard(); LLFloaterPostcard* savePostcard();
void saveTexture(); void saveTexture();
static void saveTextureDone(LLUUID const& asset_id, void* user_data, S32 status, LLExtStat ext_status); 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 saveLocal();
void saveStart(int index); void saveStart(int index);
void saveDone(ESnapshotType type, bool success, 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), mColor(1.f, 0.f, 0.f, 0.5f),
mRawSnapshot(NULL), mRawSnapshot(NULL),
mRawSnapshotWidth(0), mRawSnapshotWidth(0),
mRawSnapshotHeight(0), mRawSnapshotHeight(1),
mRawSnapshotAspectRatio(1.0), mRawSnapshotAspectRatio(1.0),
mRawSnapshotRenderUI(FALSE), mRawSnapshotRenderUI(FALSE),
mRawSnapshotRenderHUD(FALSE), mRawSnapshotRenderHUD(FALSE),
@@ -409,7 +412,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR), mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR),
mCloseCalled(NULL) mCloseCalled(NULL)
{ {
DoutEntering(dc::notice, "LLSnapshotLivePreview() [" << (void*)this << "]"); DoutEntering(dc::snapshot, "LLSnapshotLivePreview() [" << (void*)this << "]");
setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")); setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
mSnapshotDelayTimer.start(); mSnapshotDelayTimer.start();
sList.insert(this); sList.insert(this);
@@ -430,7 +433,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
LLSnapshotLivePreview::~LLSnapshotLivePreview() LLSnapshotLivePreview::~LLSnapshotLivePreview()
{ {
DoutEntering(dc::notice, "~LLSnapshotLivePreview() [" << (void*)this << "]"); DoutEntering(dc::snapshot, "~LLSnapshotLivePreview() [" << (void*)this << "]");
sList.erase(this); sList.erase(this);
// Stop callbacks from using this object. // Stop callbacks from using this object.
++sSnapshotIndex; ++sSnapshotIndex;
@@ -455,7 +458,7 @@ LLViewerTexture* LLSnapshotLivePreview::getCurrentImage()
void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show) 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 we stop to show the fullscreen "freeze frame" snapshot, play the "fall away" animation.
if (mShowFreezeFrameSnapshot && !show) if (mShowFreezeFrameSnapshot && !show)
{ {
@@ -471,7 +474,7 @@ void LLSnapshotLivePreview::showFreezeFrameSnapshot(bool show)
void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) 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; LLRect& rect = mFullScreenImageRect;
rect.set(0, getRect().getHeight(), getRect().getWidth(), 0); rect.set(0, getRect().getHeight(), getRect().getWidth(), 0);
@@ -820,7 +823,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void)
return ; return ;
} }
Dout(dc::notice, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!"); Dout(dc::snapshot, "LLSnapshotLivePreview::generateThumbnailImage: Actually making a new thumbnail!");
mThumbnailImage = NULL; mThumbnailImage = NULL;
@@ -843,7 +846,7 @@ void LLSnapshotLivePreview::generateThumbnailImage(void)
{ {
mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); mThumbnailImage = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE);
mThumbnailUpToDate = TRUE ; 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 //unlock updating
@@ -903,7 +906,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
previewp->getWindow()->incBusyCount(); previewp->getWindow()->incBusyCount();
// Grab the raw image and encode it into desired format. // 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 // This should never happen, but well. If it's true then that means that the
// snapshot floater is disabled. Incrementing sSnapshotIndex will cause the // snapshot floater is disabled. Incrementing sSnapshotIndex will cause the
@@ -911,9 +914,10 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
if (previewp->mCloseCalled) if (previewp->mCloseCalled)
{ {
previewp->mCloseCalled->setEnabled(TRUE); previewp->mCloseCalled->setEnabled(TRUE);
previewp->mCloseCalled->setVisible(TRUE);
} }
previewp->sSnapshotIndex++; 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->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. 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; previewp->mRawSnapshotAspectRatio = previewp->mAspectRatio;
// Mark that the those values do not represent the current snapshot (yet). // Mark that the those values do not represent the current snapshot (yet).
previewp->mRawSnapshotWidth = 0; previewp->mRawSnapshotWidth = 0;
previewp->mRawSnapshotHeight = 0; previewp->mRawSnapshotHeight = 1; // Avoid division by zero when calculation an aspect in LLSnapshotLivePreview::getAspectSizeProblem.
if (gViewerWindow->rawRawSnapshot( if (gViewerWindow->rawRawSnapshot(
previewp->mRawSnapshot, previewp->mRawSnapshot,
@@ -945,7 +949,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
// On success, cache the size of the raw snapshot. // On success, cache the size of the raw snapshot.
previewp->mRawSnapshotWidth = previewp->mRawSnapshot->getWidth(); previewp->mRawSnapshotWidth = previewp->mRawSnapshot->getWidth();
previewp->mRawSnapshotHeight = previewp->mRawSnapshot->getHeight(); 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(); previewp->mPosTakenGlobal = gAgentCamera.getCameraPositionGlobal();
EAspectSizeProblem ret = previewp->generateFormattedAndFullscreenPreview(); EAspectSizeProblem ret = previewp->generateFormattedAndFullscreenPreview();
@@ -1011,7 +1015,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
crop_vertically_out = false; crop_vertically_out = false;
if (!allow_horizontal_crop) 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."); " is less than the (lower) raw aspect " << lower_raw_aspect << " which is already vertically cropped.");
return CANNOT_CROP_HORIZONTALLY; return CANNOT_CROP_HORIZONTALLY;
} }
@@ -1025,7 +1029,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
{ {
if (!allow_vertical_crop) 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."); " is larger than the (upper) raw aspect " << upper_raw_aspect << " which is already horizontally cropped.");
return CANNOT_CROP_VERTICALLY; return CANNOT_CROP_VERTICALLY;
} }
@@ -1035,7 +1039,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
// Never allow upscaling of the existing snapshot, of course. // Never allow upscaling of the existing snapshot, of course.
if (mWidth > width_out || mHeight > height_out) 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 << "!"); " is larger than (cropped) raw snapshot with size " << width_out << "x" << height_out << "!");
return SIZE_TOO_LARGE; 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. // 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) 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 << ")" " is larger or equal the window size (" << window_width << "x" << window_height << ")"
" but unequal the (cropped) raw snapshot size (" << width_out << "x" << height_out << ")" " but unequal the (cropped) raw snapshot size (" << width_out << "x" << height_out << ")"
" and target is disk!"); " and target is disk!");
@@ -1055,7 +1059,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr
LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(bool delayed) LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(bool delayed)
{ {
DoutEntering(dc::notice, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")"); DoutEntering(dc::snapshot, "LLSnapshotLivePreview::generateFormattedAndFullscreenPreview(" << delayed << ")");
mFormattedUpToDate = false; mFormattedUpToDate = false;
S32 w, h, crop_offset; S32 w, h, crop_offset;
@@ -1101,7 +1105,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt
(mFormattedSnapshotQuality == mSnapshotQuality || (mFormattedSnapshotQuality == mSnapshotQuality ||
format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG)) format != LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG))
{ {
Dout(dc::notice, "Already up to date."); Dout(dc::snapshot, "Already up to date.");
mFormattedUpToDate = true; mFormattedUpToDate = true;
return ret; return ret;
} }
@@ -1109,43 +1113,43 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::generateFormatt
#ifdef CWDEBUG #ifdef CWDEBUG
if (!mFormattedImage) if (!mFormattedImage)
{ {
Dout(dc::notice, "mFormattedImage == NULL!"); Dout(dc::snapshot, "mFormattedImage == NULL!");
} }
else else
{ {
if (mFormattedWidth != mWidth) 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) 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) 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) 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) 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) 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) 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)) 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 #endif
if (delayed) if (delayed)
{ {
// Just set mFormattedUpToDate. // 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; return DELAYED;
} }
if (!mRawSnapshot) if (!mRawSnapshot)
{ {
Dout(dc::notice, "No raw snapshot exists."); Dout(dc::snapshot, "No raw snapshot exists.");
return NO_RAW_IMAGE; return NO_RAW_IMAGE;
} }
Dout(dc::notice, "Generating a new formatted image!"); Dout(dc::snapshot, "Generating a new formatted image!");
mFormattedWidth = mWidth; mFormattedWidth = mWidth;
mFormattedHeight = mHeight; mFormattedHeight = mHeight;
@@ -1313,7 +1317,7 @@ LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed()
++mOutstandingCallbacks; ++mOutstandingCallbacks;
mSaveFailures = 0; mSaveFailures = 0;
addUsedBy(SNAPSHOT_FEED); addUsedBy(SNAPSHOT_FEED);
Dout(dc::notice, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); Dout(dc::snapshot, "LLSnapshotLivePreview::getCaptionAndSaveFeed: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if (mFullScreenPreviewTexture.isNull()) if (mFullScreenPreviewTexture.isNull())
{ {
@@ -1351,7 +1355,7 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
++mOutstandingCallbacks; ++mOutstandingCallbacks;
mSaveFailures = 0; mSaveFailures = 0;
addUsedBy(SNAPSHOT_POSTCARD); addUsedBy(SNAPSHOT_POSTCARD);
Dout(dc::notice, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); Dout(dc::snapshot, "LLSnapshotLivePreview::savePostcard: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if(mFullScreenPreviewTexture.isNull()) if(mFullScreenPreviewTexture.isNull())
{ {
@@ -1382,9 +1386,10 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
class saveTextureUserData { class saveTextureUserData {
public: 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; LLSnapshotLivePreview* mSelf;
int mSnapshotIndex; int mSnapshotIndex;
bool mTemporary;
}; };
void LLSnapshotLivePreview::saveTexture() void LLSnapshotLivePreview::saveTexture()
@@ -1397,7 +1402,7 @@ void LLSnapshotLivePreview::saveTexture()
++mOutstandingCallbacks; ++mOutstandingCallbacks;
mSaveFailures = 0; mSaveFailures = 0;
addUsedBy(SNAPSHOT_TEXTURE); addUsedBy(SNAPSHOT_TEXTURE);
Dout(dc::notice, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); Dout(dc::snapshot, "LLSnapshotLivePreview::saveTexture: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
saveStart(sSnapshotIndex); saveStart(sSnapshotIndex);
// gen a new uuid for this asset // gen a new uuid for this asset
@@ -1411,7 +1416,8 @@ void LLSnapshotLivePreview::saveTexture()
LLAgentUI::buildFullname(who_took_it); LLAgentUI::buildFullname(who_took_it);
LLAssetStorage::LLStoreAssetCallback callback = &LLSnapshotLivePreview::saveTextureDone; LLAssetStorage::LLStoreAssetCallback callback = &LLSnapshotLivePreview::saveTextureDone;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); 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, LLAssetType::AT_TEXTURE,
"Snapshot : " + pos_string, "Snapshot : " + pos_string,
"Taken by " + who_took_it + " at " + 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::getGroupPerms(), // that is more permissive than other uploads
LLFloaterPerms::getEveryonePerms(), LLFloaterPerms::getEveryonePerms(),
"Snapshot : " + pos_string, "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(); gViewerWindow->playSnapshotAnimAndSound();
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT );
@@ -1438,7 +1449,7 @@ void LLSnapshotLivePreview::saveLocal()
++mOutstandingCallbacks; ++mOutstandingCallbacks;
mSaveFailures = 0; mSaveFailures = 0;
addUsedBy(SNAPSHOT_LOCAL); addUsedBy(SNAPSHOT_LOCAL);
Dout(dc::notice, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); Dout(dc::snapshot, "LLSnapshotLivePreview::saveLocal: sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
saveStart(sSnapshotIndex); saveStart(sSnapshotIndex);
gViewerWindow->saveImageNumbered(mFormattedImage, sSnapshotIndex); // This calls saveDone() immediately, or later. gViewerWindow->saveImageNumbered(mFormattedImage, sSnapshotIndex); // This calls saveDone() immediately, or later.
@@ -1446,7 +1457,7 @@ void LLSnapshotLivePreview::saveLocal()
void LLSnapshotLivePreview::close(LLFloaterSnapshot* view) 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; mCloseCalled = view;
if (!mOutstandingCallbacks) if (!mOutstandingCallbacks)
{ {
@@ -1454,6 +1465,7 @@ void LLSnapshotLivePreview::close(LLFloaterSnapshot* view)
} }
else else
{ {
view->setVisible(FALSE);
view->setEnabled(FALSE); view->setEnabled(FALSE);
} }
} }
@@ -1479,11 +1491,11 @@ void LLSnapshotLivePreview::saveStart(int index)
void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, 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) 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. // The snapshot was already replaced, so this callback has nothing to do with us anymore.
if (!success) if (!success)
@@ -1494,7 +1506,7 @@ void LLSnapshotLivePreview::saveDone(ESnapshotType type, bool success, int index
} }
--mOutstandingCallbacks; --mOutstandingCallbacks;
Dout(dc::notice, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << "."); Dout(dc::snapshot, "sSnapshotIndex = " << sSnapshotIndex << "; mOutstandingCallbacks = " << mOutstandingCallbacks << ".");
if (!success) if (!success)
{ {
++mSaveFailures; ++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 //static
void LLSnapshotLivePreview::saveTextureDone(LLUUID const& asset_id, void* user_data, S32 status, LLExtStat ext_status) 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) if (!success)
{ {
LLSD args; LLSD args;
args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
LLNotificationsUtil::add("UploadSnapshotFail", args); 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; saveTextureUserData* data = (saveTextureUserData*)user_data;
data->mSelf->saveDone(SNAPSHOT_TEXTURE, success, data->mSnapshotIndex); data->mSelf->saveDone(SNAPSHOT_TEXTURE, success, data->mSnapshotIndex);
delete data; delete data;
@@ -1541,6 +1573,8 @@ void LLSnapshotLivePreview::doCloseAfterSave()
else else
{ {
mCloseCalled->setEnabled(TRUE); mCloseCalled->setEnabled(TRUE);
mCloseCalled->setVisible(TRUE);
gFloaterView->bringToFront(mCloseCalled);
mCloseCalled = NULL; mCloseCalled = NULL;
} }
} }
@@ -1623,7 +1657,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
S32 delta_height = 0; S32 delta_height = 0;
if (!gSavedSettings.getBOOL("AdvanceSnapshot")) if (!gSavedSettings.getBOOL("AdvanceSnapshot"))
{ {
floaterp->getChild<LLComboBox>("feed_size_combo")->setCurrentByIndex(2); // 500x375 floaterp->getChild<LLComboBox>("feed_size_combo")->setCurrentByIndex(2); // 500x375 (4:3)
gSavedSettings.setS32("SnapshotFeedLastResolution", 2); gSavedSettings.setS32("SnapshotFeedLastResolution", 2);
floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0); // Current window floaterp->getChild<LLComboBox>("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 // can see and interact with fullscreen preview now
if (previewp) if (previewp)
{ {
previewp->setVisible(TRUE);
previewp->setEnabled(TRUE); previewp->setEnabled(TRUE);
previewp->setVisible(TRUE);
} }
// Freeze all avatars. // Freeze all avatars.
@@ -1717,7 +1751,7 @@ void LLFloaterSnapshot::Impl::freezeTime(bool on)
// static // static
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater, bool delayed_formatted) 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(); std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee();
if (gSavedSettings.getBOOL("TemporaryUpload")) if (gSavedSettings.getBOOL("TemporaryUpload"))
{ {
@@ -2018,6 +2052,7 @@ void LLFloaterSnapshot::saveLocalDone(bool success, int index)
//static //static
void LLFloaterSnapshot::saveFeedDone(bool success, int index) void LLFloaterSnapshot::saveFeedDone(bool success, int index)
{ {
LLUploadDialog::modalUploadFinished();
LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(); LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView();
if (previewp) if (previewp)
{ {
@@ -2028,6 +2063,7 @@ void LLFloaterSnapshot::saveFeedDone(bool success, int index)
//static //static
void LLFloaterSnapshot::savePostcardDone(bool success, int index) void LLFloaterSnapshot::savePostcardDone(bool success, int index)
{ {
LLUploadDialog::modalUploadFinished();
LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(); LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView();
if (previewp) if (previewp)
{ {
@@ -2223,7 +2259,7 @@ void LLFloaterSnapshot::Impl::onCommitQuality(LLUICtrl* ctrl, void* data)
//static //static
void LLFloaterSnapshot::Impl::onQualityMouseUp(void* data) void LLFloaterSnapshot::Impl::onQualityMouseUp(void* data)
{ {
Dout(dc::notice, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()"); Dout(dc::snapshot, "Calling LLFloaterSnapshot::Impl::QualityMouseUp()");
LLFloaterSnapshot* view = (LLFloaterSnapshot *)data; LLFloaterSnapshot* view = (LLFloaterSnapshot *)data;
updateControls(view); updateControls(view);
} }
@@ -2502,6 +2538,15 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); 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 else
{ {
// use the resolution from the selected pre-canned drop-down choice // use the resolution from the selected pre-canned drop-down choice
@@ -2948,9 +2993,9 @@ void LLFloaterSnapshot::onOpen()
void LLFloaterSnapshot::onClose(bool app_quitting) void LLFloaterSnapshot::onClose(bool app_quitting)
{ {
gSnapshotFloaterView->setEnabled(FALSE);
// Set invisible so it doesn't eat tooltips. JC // Set invisible so it doesn't eat tooltips. JC
gSnapshotFloaterView->setVisible(FALSE); gSnapshotFloaterView->setVisible(FALSE);
gSnapshotFloaterView->setEnabled(FALSE);
gSavedSettings.setBOOL("SnapshotBtnState", FALSE); gSavedSettings.setBOOL("SnapshotBtnState", FALSE);
impl.freezeTime(false); impl.freezeTime(false);
destroy(); destroy();
@@ -2980,6 +3025,8 @@ void LLFloaterSnapshot::show(void*)
sInstance->open(); /* Flawfinder: ignore */ sInstance->open(); /* Flawfinder: ignore */
sInstance->focusFirstItem(FALSE); sInstance->focusFirstItem(FALSE);
sInstance->setEnabled(TRUE);
sInstance->setVisible(TRUE);
gSnapshotFloaterView->setEnabled(TRUE); gSnapshotFloaterView->setEnabled(TRUE);
gSnapshotFloaterView->setVisible(TRUE); gSnapshotFloaterView->setVisible(TRUE);
gSnapshotFloaterView->adjustToFitScreen(sInstance, FALSE); 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) LLSnapshotFloaterView::LLSnapshotFloaterView( const std::string& name, const LLRect& rect ) : LLFloaterView(name, rect)
{ {
setMouseOpaque(TRUE); setMouseOpaque(FALSE);
setEnabled(FALSE); setEnabled(FALSE);
} }

View File

@@ -63,8 +63,7 @@ extern AIHTTPTimeoutPolicy placeAvatarTeleportResponder_timeout;
// OGPX TODO: should this be combined with the Login responder for rez_avatar/place? // OGPX TODO: should this be combined with the Login responder for rez_avatar/place?
// OGPX TODO: mResult should not get replaced in result(), instead // OGPX TODO: mResult should not get replaced in result(), instead
// should replace individual LLSD fields in mResult. // should replace individual LLSD fields in mResult.
class LLPlaceAvatarTeleportResponder : class LLPlaceAvatarTeleportResponder : public LLHTTPClient::ResponderWithResult
public LLHTTPClient::ResponderWithResult
{ {
public: public:
LLPlaceAvatarTeleportResponder() 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 " LL_INFOS("OGPX") << "LLPlaceAvatarTeleportResponder error in TP "
<< statusNum << " " << reason << LL_ENDL; << statusNum << " " << reason << LL_ENDL;
@@ -90,7 +89,7 @@ public:
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
LLSD result; 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 // Statics

View File

@@ -113,13 +113,13 @@ class LLIamHere : public LLHTTPClient::ResponderWithResult
mParent = parentIn; mParent = parentIn;
}; };
virtual void result( const LLSD& content ) /*virtual*/ void result( const LLSD& content )
{ {
if ( mParent ) if ( mParent )
mParent->setSiteIsAlive( true ); mParent->setSiteIsAlive( true );
}; };
virtual void error( U32 status, const std::string& reason ) /*virtual*/ void error( U32 status, const std::string& reason )
{ {
if ( mParent ) 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 // this is global and not a class member to keep crud out of the header file

View File

@@ -62,7 +62,7 @@ public:
LLHandle<LLFloater> mParent; LLHandle<LLFloater> 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) if (200 <= status && status < 300)
{ {
@@ -89,7 +89,9 @@ public:
floater_url_entry->headerFetchComplete( status, resolved_mime_type ); 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"; }
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -1896,12 +1896,12 @@ extern AIHTTPTimeoutPolicy groupMemberDataResponder_timeout;
class GroupMemberDataResponder : public LLHTTPClient::ResponderWithResult class GroupMemberDataResponder : public LLHTTPClient::ResponderWithResult
{ {
public: public:
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupMemberDataResponder_timeout; }
GroupMemberDataResponder() {} GroupMemberDataResponder() {}
virtual ~GroupMemberDataResponder() {} virtual ~GroupMemberDataResponder() {}
virtual void result(const LLSD& pContent); /*virtual*/ void result(const LLSD& pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*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: private:
LLSD mMemberData; LLSD mMemberData;
}; };

View File

@@ -44,9 +44,10 @@ extern AIHTTPTimeoutPolicy homeLocationResponder_timeout;
/* Typedef, Enum, Class, Struct, etc. */ /* Typedef, Enum, Class, Struct, etc. */
class LLHomeLocationResponder : public LLHTTPClient::ResponderWithResult class LLHomeLocationResponder : public LLHTTPClient::ResponderWithResult
{ {
virtual void result( const LLSD& content ); /*virtual*/ void result( const LLSD& content );
virtual void error( U32 status, const std::string& reason ); /*virtual*/ void error( U32 status, const std::string& reason );
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return homeLocationResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return homeLocationResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLHomeLocationResponder"; }
}; };
#endif #endif

View File

@@ -199,7 +199,7 @@ public:
mAgents = agents_to_invite; 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. //try an "old school" way.
if ( statusNum == 400 ) if ( statusNum == 400 )
@@ -219,7 +219,8 @@ public:
//the possible different language translations //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: private:
LLUUID mTempSessionID; LLUUID mTempSessionID;
@@ -306,9 +307,10 @@ class LLVoiceCallCapResponder : public LLHTTPClient::ResponderWithResult
public: public:
LLVoiceCallCapResponder(const LLUUID& session_id) : mSessionID(session_id) {}; LLVoiceCallCapResponder(const LLUUID& session_id) : mSessionID(session_id) {};
virtual void error(U32 status, const std::string& reason); // called with bad status codes /*virtual*/ void error(U32 status, const std::string& reason); // called with bad status codes
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceCallCapResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceCallCapResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLVoiceCallCapResponder"; }
private: private:
LLUUID mSessionID; LLUUID mSessionID;
@@ -1562,13 +1564,14 @@ public:
mSessionID = session_id; 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; llinfos << "Error inviting all agents to session" << llendl;
//throw something back to the viewer here? //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: private:
LLUUID mSessionID; LLUUID mSessionID;

View File

@@ -94,8 +94,7 @@ LLIMMgr* gIMMgr = NULL;
//{ //{
// return (LLStringUtil::compareDict( a->mName, b->mName ) < 0); // return (LLStringUtil::compareDict( a->mName, b->mName ) < 0);
//} //}
class LLViewerChatterBoxInvitationAcceptResponder : class LLViewerChatterBoxInvitationAcceptResponder : public LLHTTPClient::ResponderWithResult
public LLHTTPClient::ResponderWithResult
{ {
public: public:
LLViewerChatterBoxInvitationAcceptResponder( LLViewerChatterBoxInvitationAcceptResponder(
@@ -106,7 +105,7 @@ public:
mInvitiationType = invitation_type; mInvitiationType = invitation_type;
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
if ( gIMMgr) 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? //throw something back to the viewer here?
if ( gIMMgr ) 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: private:
LLUUID mSessionID; LLUUID mSessionID;

View File

@@ -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; 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. //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: private:
void (*mCallback)(const LLSD&, void*); void (*mCallback)(const LLSD&, void*);

View File

@@ -87,9 +87,10 @@ public:
{ {
public: public:
fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fetchInventoryResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return fetchInventoryResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "fetchInventoryResponder"; }
protected: protected:
LLSD mRequestSD; LLSD mRequestSD;
}; };

View File

@@ -376,9 +376,10 @@ class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInvento
{ {
public: public:
LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {}; LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {};
void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchItemResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchItemResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLInventoryModelFetchItemResponder"; }
}; };
void LLInventoryModelFetchItemResponder::result( const LLSD& content ) void LLInventoryModelFetchItemResponder::result( const LLSD& content )
@@ -393,7 +394,7 @@ void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& r
LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
} }
class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::ResponderWithResult class LLInventoryModelFetchDescendentsResponder : public LLHTTPClient::ResponderWithResult
{ {
public: public:
LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) : LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd, uuid_vec_t recursive_cats) :
@@ -401,9 +402,10 @@ class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::ResponderW
mRecursiveCatUUIDs(recursive_cats) mRecursiveCatUUIDs(recursive_cats)
{}; {};
//LLInventoryModelFetchDescendentsResponder() {}; //LLInventoryModelFetchDescendentsResponder() {};
void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchDescendentsResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return inventoryModelFetchDescendentsResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLInventoryModelFetchDescendentsResponder"; }
protected: protected:
BOOL getIsRecursive(const LLUUID& cat_id) const; BOOL getIsRecursive(const LLUUID& cat_id) const;

View File

@@ -40,8 +40,9 @@ extern AIHTTPTimeoutPolicy mapLayerResponder_timeout;
class LLMapLayerResponder : public LLHTTPClient::ResponderWithResult class LLMapLayerResponder : public LLHTTPClient::ResponderWithResult
{ {
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mapLayerResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mapLayerResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLMapLayerResponder"; }
}; };
#endif // LL_LLMAPLAYERRESPONDER_H #endif // LL_LLMAPLAYERRESPONDER_H

View File

@@ -157,9 +157,7 @@ namespace LLMarketplaceImport
class LLImportPostResponder : public LLHTTPClient::ResponderWithCompleted class LLImportPostResponder : public LLHTTPClient::ResponderWithCompleted
{ {
public: public:
AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportPostResponder_timeout; } /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
void completed(U32 status, const std::string& reason, const LLSD& content)
{ {
slmPostTimer.stop(); slmPostTimer.stop();
@@ -189,13 +187,14 @@ namespace LLMarketplaceImport
sImportResultStatus = status; sImportResultStatus = status;
sImportId = content; sImportId = content;
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportPostResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLImportPostResponder"; }
}; };
class LLImportGetResponder : public LLHTTPClient::ResponderWithCompleted class LLImportGetResponder : public LLHTTPClient::ResponderWithCompleted
{ {
public: public:
AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportGetResponder_timeout; }
/*virtual*/ bool followRedir(void) const { return true; } /*virtual*/ bool followRedir(void) const { return true; }
/*virtual*/ bool needsHeaders(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(); slmGetTimer.stop();
@@ -244,6 +243,9 @@ namespace LLMarketplaceImport
sImportResultStatus = status; sImportResultStatus = status;
sImportResults = content; sImportResults = content;
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportGetResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLImportGetResponder"; }
}; };
// Basic API // Basic API

View File

@@ -225,11 +225,12 @@ public:
LLMeshRepoThread::sActiveHeaderRequests--; LLMeshRepoThread::sActiveHeaderRequests--;
} }
virtual void completedRaw(U32 status, const std::string& reason, /*virtual*/ void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer); 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 class LLMeshLODResponder : public LLHTTPClient::ResponderWithCompleted
@@ -251,11 +252,12 @@ public:
LLMeshRepoThread::sActiveLODRequests--; LLMeshRepoThread::sActiveLODRequests--;
} }
virtual void completedRaw(U32 status, const std::string& reason, /*virtual*/ void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer); 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 class LLMeshSkinInfoResponder : public LLHTTPClient::ResponderWithCompleted
@@ -270,11 +272,12 @@ public:
{ {
} }
virtual void completedRaw(U32 status, const std::string& reason, /*virtual*/ void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer); 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 class LLMeshDecompositionResponder : public LLHTTPClient::ResponderWithCompleted
@@ -289,11 +292,12 @@ public:
{ {
} }
virtual void completedRaw(U32 status, const std::string& reason, /*virtual*/ void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer); 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 class LLMeshPhysicsShapeResponder : public LLHTTPClient::ResponderWithCompleted
@@ -308,11 +312,12 @@ public:
{ {
} }
virtual void completedRaw(U32 status, const std::string& reason, /*virtual*/ void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer); 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"; }
}; };
void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name) void log_upload_error(S32 status, const LLSD& content, std::string stage, std::string model_name)
@@ -364,7 +369,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; LLMeshUploadThread* mThread;
LLSD mModelData; LLSD mModelData;
@@ -389,9 +394,9 @@ public:
} }
} }
virtual void completed(U32 status, /*virtual*/ void completed(U32 status,
const std::string& reason, const std::string& reason,
const LLSD& content) const LLSD& content)
{ {
LLSD cc = content; LLSD cc = content;
if (gSavedSettings.getS32("MeshUploadFakeErrors")&1) if (gSavedSettings.getS32("MeshUploadFakeErrors")&1)
@@ -427,10 +432,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; LLMeshUploadThread* mThread;
LLSD mModelData; LLSD mModelData;
@@ -456,9 +462,9 @@ public:
} }
} }
virtual void completed(U32 status, /*virtual*/ void completed(U32 status,
const std::string& reason, const std::string& reason,
const LLSD& content) const LLSD& content)
{ {
LLSD cc = content; LLSD cc = content;
if (gSavedSettings.getS32("MeshUploadFakeErrors")&2) if (gSavedSettings.getS32("MeshUploadFakeErrors")&2)
@@ -496,7 +502,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"; }
}; };
LLMeshRepoThread::LLMeshRepoThread() LLMeshRepoThread::LLMeshRepoThread()

View File

@@ -693,7 +693,7 @@ public:
} }
//If we get back a normal response, handle it here //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. //Ack'd the proposal initialization, now let's finish up.
LLPanelGroupVoting::handleResponse( LLPanelGroupVoting::handleResponse(
@@ -702,7 +702,7 @@ public:
} }
//If we get back an error (not found, etc...), handle it here //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 " llinfos << "LLPanelGroupVotingResponder::error "
<< status << ": " << reason << llendl; << status << ": " << reason << llendl;
@@ -710,8 +710,8 @@ public:
LLPanelGroupVoting::handleFailure(mGroupID); 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: private:
LLUUID mGroupID; LLUUID mGroupID;
@@ -726,7 +726,7 @@ public:
} }
//If we get back a normal response, handle it here //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. //Ack'd the proposal initialization, now let's finish up.
LLPanelGroupVoting::handleResponse( LLPanelGroupVoting::handleResponse(
@@ -736,7 +736,7 @@ public:
} }
//If we get back an error (not found, etc...), handle it here //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 " llinfos << "LLPanelGroupVotingResponder::error "
<< status << ": " << reason << llendl; << status << ": " << reason << llendl;
@@ -745,7 +745,8 @@ public:
} }
//Return out timeout policy. //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: private:
LLUUID mGroupID; LLUUID mGroupID;

View File

@@ -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 // this is global and not a class member to keep crud out of the header file

View File

@@ -116,9 +116,10 @@ public:
NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly); NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
virtual ~NavMeshStatusResponder(); virtual ~NavMeshStatusResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*virtual*/ void error(U32 pStatus, const std::string& pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshStatusResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshStatusResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "NavMeshStatusResponder"; }
protected: protected:
@@ -139,9 +140,10 @@ public:
NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr); NavMeshResponder(const std::string &pCapabilityURL, U32 pNavMeshVersion, LLPathfindingNavMeshPtr pNavMeshPtr);
virtual ~NavMeshResponder(); virtual ~NavMeshResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*virtual*/ void error(U32 pStatus, const std::string& pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "NavMeshResponder"; }
protected: protected:
@@ -161,9 +163,10 @@ public:
AgentStateResponder(const std::string &pCapabilityURL); AgentStateResponder(const std::string &pCapabilityURL);
virtual ~AgentStateResponder(); virtual ~AgentStateResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*virtual*/ void error(U32 pStatus, const std::string& pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return agentStateResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return agentStateResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "AgentStateResponder"; }
protected: protected:
@@ -181,9 +184,10 @@ public:
NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback); NavMeshRebakeResponder(const std::string &pCapabilityURL, LLPathfindingManager::rebake_navmesh_callback_t pRebakeNavMeshCallback);
virtual ~NavMeshRebakeResponder(); virtual ~NavMeshRebakeResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string& pReason); /*virtual*/ void error(U32 pStatus, const std::string& pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshRebakeResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return navMeshRebakeResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "NavMeshRebakeResponder"; }
protected: protected:
@@ -241,9 +245,10 @@ public:
ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); ObjectLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr);
virtual ~ObjectLinksetsResponder(); virtual ~ObjectLinksetsResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string &pReason); /*virtual*/ void error(U32 pStatus, const std::string &pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectLinksetsResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return objectLinksetsResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "ObjectLinksetsResponder"; }
protected: protected:
@@ -261,9 +266,10 @@ public:
TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr); TerrainLinksetsResponder(const std::string &pCapabilityURL, LinksetsResponderPtr pLinksetsResponsderPtr);
virtual ~TerrainLinksetsResponder(); virtual ~TerrainLinksetsResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string &pReason); /*virtual*/ void error(U32 pStatus, const std::string &pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return terrainLinksetsResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return terrainLinksetsResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "TerrainLinksetsResponder"; }
protected: protected:
@@ -281,9 +287,10 @@ public:
CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback); CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::object_request_callback_t pCharactersCallback);
virtual ~CharactersResponder(); virtual ~CharactersResponder();
virtual void result(const LLSD &pContent); /*virtual*/ void result(const LLSD &pContent);
virtual void error(U32 pStatus, const std::string &pReason); /*virtual*/ void error(U32 pStatus, const std::string &pReason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return charactersResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return charactersResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "CharactersResponder"; }
protected: protected:

View File

@@ -46,19 +46,20 @@ class LLProductInfoRequestResponder : public LLHTTPClient::ResponderWithResult
{ {
public: public:
//If we get back a normal response, handle it here //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); LLProductInfoRequestManager::instance().setSkuDescriptions(content);
} }
//If we get back an error (not found, etc...), handle it here //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(" llwarns << "LLProductInfoRequest::error("
<< status << ": " << reason << ")" << llendl; << 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() LLProductInfoRequestManager::LLProductInfoRequestManager() : mSkuDescriptions()

View File

@@ -46,10 +46,11 @@ class LLRemoteParcelRequestResponder : public LLHTTPClient::ResponderWithResult
public: public:
LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle); LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle);
//If we get back a normal response, handle it here //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 //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);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLRemoteParcelRequestResponder"; }
protected: protected:
LLHandle<LLPanel> mPlacePanelHandle; LLHandle<LLPanel> mPlacePanelHandle;

View File

@@ -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 #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; } /*virtual*/ bool needsHeaders(void) const { return true; }
@@ -413,6 +411,9 @@ public:
return mFollowRedir; return mFollowRedir;
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return HTTPGetResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "HTTPGetResponder"; }
private: private:
LLTextureFetch* mFetcher; LLTextureFetch* mFetcher;
LLUUID mID; LLUUID mID;
@@ -3107,8 +3108,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
mFetcher->decrCurlPOSTCount(); mFetcher->decrCurlPOSTCount();
} }
// virtual /*virtual*/ void error(U32 status_num, const std::string & reason)
void error(U32 status_num, const std::string & reason)
{ {
if (mLiveSequence == mExpectedSequence) if (mLiveSequence == mExpectedSequence)
{ {
@@ -3118,8 +3118,7 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
<< reason << LL_ENDL; << reason << LL_ENDL;
} }
// virtual /*virtual*/ void result(const LLSD & content)
void result(const LLSD & content)
{ {
if (mLiveSequence == mExpectedSequence) if (mLiveSequence == mExpectedSequence)
{ {
@@ -3127,7 +3126,8 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher)
mReportingStarted = true; 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: private:
LLTextureFetch * mFetcher; LLTextureFetch * mFetcher;

View File

@@ -43,7 +43,7 @@ extern AIHTTPTimeoutPolicy translationReceiver_timeout;
class LLTranslate class LLTranslate
{ {
public : public :
class TranslationReceiver: public LLHTTPClient::ResponderWithResult class TranslationReceiver : public LLHTTPClient::ResponderWithResult
{ {
protected: protected:
TranslationReceiver(const std::string &fromLang, const std::string &toLang) 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; LL_WARNS("Translate") << "URL Request error: " << reason << LL_ENDL;
handleFailure(); handleFailure();
} }
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return translationReceiver_timeout; } /*virtual*/ void completedRaw(
virtual void completedRaw(
U32 status, U32 status,
const std::string& reason, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
@@ -100,6 +98,8 @@ public :
handleResponse(translation, detectedLanguage); handleResponse(translation, detectedLanguage);
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return translationReceiver_timeout; }
protected: protected:
const std::string m_toLang; const std::string m_toLang;
const std::string m_fromLang; const std::string m_fromLang;

View File

@@ -75,7 +75,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg)
} }
LLUploadDialog::sDialog = this; LLUploadDialog::sDialog = this;
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_BIG );
LLRect msg_rect; LLRect msg_rect;
for (int line_num=0; line_num<16; ++line_num) 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) 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 VPAD = 16;
const S32 HPAD = 25; const S32 HPAD = 25;
@@ -127,14 +130,14 @@ void LLUploadDialog::setMessage( const std::string& msg)
S32 line_height = S32( font->getLineHeight() + 0.99f ); S32 line_height = S32( font->getLineHeight() + 0.99f );
S32 dialog_width = max_msg_width + 2 * HPAD; S32 dialog_width = llmax(max_msg_width + 2 * HPAD, min_width);
S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD; S32 dialog_height = llmax(line_height * (S32)msg_lines.size() + 2 * VPAD, min_height);
reshape( dialog_width, dialog_height, FALSE ); reshape( dialog_width, dialog_height, FALSE );
// Message // Message
S32 msg_x = (getRect().getWidth() - max_msg_width) / 2; 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; int line_num;
for (line_num=0; line_num<16; ++line_num) for (line_num=0; line_num<16; ++line_num)
{ {

View File

@@ -104,11 +104,10 @@ public:
LLUploadModelPremissionsResponder(const LLHandle<LLUploadPermissionsObserver>& observer); LLUploadModelPremissionsResponder(const LLHandle<LLUploadPermissionsObserver>& observer);
void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
/*virtual*/ void result(const LLSD& content);
void result(const LLSD& content); /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return uploadModelPremissionsResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLUploadModelPremissionsResponder"; }
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return uploadModelPremissionsResponder_timeout; }
private: private:
LLHandle<LLUploadPermissionsObserver> mObserverHandle; LLHandle<LLUploadPermissionsObserver> mObserverHandle;

View File

@@ -68,7 +68,8 @@ public:
LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); 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) void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot)

View File

@@ -117,6 +117,8 @@ public:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mimeDiscoveryResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return mimeDiscoveryResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLMimeDiscoveryResponder"; }
public: public:
viewer_media_t mMediaImpl; viewer_media_t mMediaImpl;
std::string mDefaultMimeType; 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") << "status = " << status << ", reason = " << reason << LL_ENDL;
LL_DEBUGS("MediaAuth") << headers << LL_ENDL; LL_DEBUGS("MediaAuth") << headers << LL_ENDL;
LLViewerMedia::openIDCookieResponse(get_cookie("agni_sl_session_id")); LLViewerMedia::openIDCookieResponse(get_cookie("agni_sl_session_id"));
} }
/* virtual */ void completedRaw( /*virtual*/ void completedRaw(
U32 status, U32 status,
const std::string& reason, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
@@ -154,26 +156,21 @@ public:
// We don't care about the content of the response, only the set-cookie header. // 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 class LLViewerMediaWebProfileResponder : public LLHTTPClient::ResponderWithCompleted
{ {
LOG_CLASS(LLViewerMediaWebProfileResponder); LOG_CLASS(LLViewerMediaWebProfileResponder);
public: public:
LLViewerMediaWebProfileResponder(std::string host) LLViewerMediaWebProfileResponder(std::string host) : mHost(host) { }
{ ~LLViewerMediaWebProfileResponder() { }
mHost = host;
}
~LLViewerMediaWebProfileResponder() /*virtual*/ bool followRedir(void) const { return true; }
{ /*virtual*/ bool needsHeaders(void) const { return true; }
}
/* virtual */ bool followRedir(void) const { return true; } /*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
/* virtual */ bool needsHeaders(void) const { return true; }
/* virtual */ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
{ {
LL_INFOS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL; LL_INFOS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL;
LL_INFOS("MediaAuth") << headers << LL_ENDL; LL_INFOS("MediaAuth") << headers << LL_ENDL;
@@ -204,7 +201,7 @@ public:
} }
} }
void completedRaw( /*virtual*/ void completedRaw(
U32 status, U32 status,
const std::string& reason, const std::string& reason,
const LLChannelDescriptors& channels, const LLChannelDescriptors& channels,
@@ -214,8 +211,10 @@ public:
// We don't care about the content of the response, only the set-cookie header. // 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; std::string mHost;
}; };

View File

@@ -1182,7 +1182,7 @@ LLSD generate_new_resource_upload_capability_body(LLAssetType::EType asset_type,
return body; 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 name,
std::string desc, S32 compression_info, std::string desc, S32 compression_info,
LLFolderType::EType destination_folder_type, LLFolderType::EType destination_folder_type,
@@ -1193,11 +1193,12 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
const std::string& display_name, const std::string& display_name,
LLAssetStorage::LLStoreAssetCallback callback, LLAssetStorage::LLStoreAssetCallback callback,
S32 expected_upload_cost, S32 expected_upload_cost,
void *userdata) void *userdata,
void (*callback2)(bool, void*))
{ {
if(gDisconnected) if(gDisconnected)
{ {
return ; return false;
} }
@@ -1234,7 +1235,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost); body["expected_upload_cost"] = LLSD::Integer(expected_upload_cost);
LLHTTPClient::post(url, body, LLHTTPClient::post(url, body,
new LLNewAgentInventoryResponder(body, uuid, asset_type)); new LLNewAgentInventoryResponder(body, uuid, asset_type, callback2, userdata));
} }
else else
{ {
@@ -1257,7 +1258,7 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
args["[AMOUNT]"] = llformat("%d", expected_upload_cost); args["[AMOUNT]"] = llformat("%d", expected_upload_cost);
LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost ); LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost );
return; return false;
} }
} }
} }
@@ -1287,6 +1288,9 @@ void upload_new_resource(const LLTransactionID &tid, LLAssetType::EType asset_ty
TRUE, TRUE,
temporary); temporary);
} }
// Return true when a call to a callback function will follow.
return true;
} }
LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid) LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid)

View File

@@ -66,7 +66,8 @@ void upload_new_resource(const std::string& src_filename,
S32 expected_upload_cost, S32 expected_upload_cost,
void *userdata); 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, LLAssetType::EType type,
std::string name, std::string name,
std::string desc, std::string desc,
@@ -79,7 +80,13 @@ void upload_new_resource(const LLTransactionID &tid,
const std::string& display_name, const std::string& display_name,
LLAssetStorage::LLStoreAssetCallback callback, LLAssetStorage::LLStoreAssetCallback callback,
S32 expected_upload_cost, 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); LLAssetID generate_asset_id_for_new_upload(const LLTransactionID& tid);

View File

@@ -3307,6 +3307,8 @@ protected:
delete m_chat; delete m_chat;
} }
/*virtual*/ char const* getName(void) const { return "ChatTranslationReceiver"; }
private: private:
LLChat *m_chat; LLChat *m_chat;
const BOOL m_history; const BOOL m_history;
@@ -3371,6 +3373,7 @@ protected:
} }
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return authHandler_timeout; } /*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) void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)

View File

@@ -111,7 +111,7 @@ void setDefaultTextures()
} }
} }
class importResponder: public LLNewAgentInventoryResponder class importResponder : public LLNewAgentInventoryResponder
{ {
public: public:
@@ -191,6 +191,8 @@ public:
LLObjectBackup::getInstance()->updateMap(content["new_asset"].asUUID()); LLObjectBackup::getInstance()->updateMap(content["new_asset"].asUUID());
LLObjectBackup::getInstance()->uploadNextAsset(); LLObjectBackup::getInstance()->uploadNextAsset();
} }
/*virtual*/ char const* getName(void) const { return "importResponder"; }
}; };
class CacheReadResponder : public LLTextureCache::ReadResponder class CacheReadResponder : public LLTextureCache::ReadResponder

View File

@@ -714,7 +714,7 @@ public:
} }
} }
void error(U32 statusNum, const std::string& reason) /*virtual*/ void error(U32 statusNum, const std::string& reason)
{ {
llwarns llwarns
<< "Transport error requesting object cost " << "Transport error requesting object cost "
@@ -726,7 +726,7 @@ public:
clear_object_list_pending_requests(); clear_object_list_pending_requests();
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
if ( !content.isMap() || content.has("error") ) 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: private:
LLSD mObjectIDs; 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 llwarns
<< "Transport error requesting object physics flags " << "Transport error requesting object physics flags "
@@ -816,7 +817,7 @@ public:
clear_object_list_pending_requests(); clear_object_list_pending_requests();
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
if ( !content.isMap() || content.has("error") ) 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: private:
LLSD mObjectIDs; LLSD mObjectIDs;

View File

@@ -219,7 +219,7 @@ public:
virtual ~BaseCapabilitiesComplete() 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; LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL;
LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); 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); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
if(!regionp) //region was removed 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<BaseCapabilitiesComplete> build( U64 region_handle, S32 id ) static boost::intrusive_ptr<BaseCapabilitiesComplete> build( U64 region_handle, S32 id )
{ {
@@ -1744,13 +1745,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; LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL;
retry(); retry();
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
if(!regionp) //region is removed or responder is not created. if(!regionp) //region is removed or responder is not created.
@@ -1762,7 +1763,8 @@ public:
regionp->setSimulatorFeatures(content); 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: private:
void retry() void retry()

View File

@@ -703,18 +703,19 @@ class ViewerStatsResponder : public LLHTTPClient::ResponderWithResult
public: public:
ViewerStatsResponder() { } ViewerStatsResponder() { }
void error(U32 statusNum, const std::string& reason) /*virtual*/ void error(U32 statusNum, const std::string& reason)
{ {
llinfos << "ViewerStatsResponder::error " << statusNum << " " llinfos << "ViewerStatsResponder::error " << statusNum << " "
<< reason << llendl; << reason << llendl;
} }
void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
llinfos << "ViewerStatsResponder::result" << llendl; 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"; }
}; };
/* /*

View File

@@ -4420,7 +4420,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw,
// Center the buffer. // Center the buffer.
buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
buffer_y_offset = llfloor(((window_height - snapshot_height) * 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); bool error = !(image_buffer_x > 0 && image_buffer_y > 0);
if (!error) if (!error)

View File

@@ -143,8 +143,7 @@ static int scale_speaker_volume(float volume)
return scaled_volume; return scaled_volume;
} }
class LLViewerVoiceAccountProvisionResponder : class LLViewerVoiceAccountProvisionResponder : public LLHTTPClient::ResponderWithResult
public LLHTTPClient::ResponderWithResult
{ {
public: public:
LLViewerVoiceAccountProvisionResponder(int retries) LLViewerVoiceAccountProvisionResponder(int retries)
@@ -152,7 +151,7 @@ public:
mRetries = retries; mRetries = retries;
} }
virtual void error(U32 status, const std::string& reason) /*virtual*/ void error(U32 status, const std::string& reason)
{ {
if ( mRetries > 0 ) if ( mRetries > 0 )
{ {
@@ -167,7 +166,7 @@ public:
} }
} }
virtual void result(const LLSD& content) /*virtual*/ void result(const LLSD& content)
{ {
if ( gVoiceClient ) 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: private:
int mRetries; int mRetries;
@@ -1019,9 +1019,10 @@ class LLVoiceClientCapResponder : public LLHTTPClient::ResponderWithResult
public: public:
LLVoiceClientCapResponder(void){}; LLVoiceClientCapResponder(void){};
virtual void error(U32 status, const std::string& reason); // called with bad status codes /*virtual*/ void error(U32 status, const std::string& reason); // called with bad status codes
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceClientCapResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return voiceClientCapResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLVoiceClientCapResponder"; }
private: private:
}; };

View File

@@ -121,6 +121,7 @@ public:
protected: protected:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; }
/*virtual*/ bool followRedir(void) const { return true; } /*virtual*/ bool followRedir(void) const { return true; }
/*virtual*/ char const* getName(void) const { return "LLWebProfileResponders::ConfigResponder"; }
private: private:
LLPointer<LLImageFormatted> mImagep; LLPointer<LLImageFormatted> mImagep;
@@ -156,8 +157,9 @@ public:
} }
protected: protected:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; }
/*virtual*/ bool followRedir(void) const { return true; } /*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: private:
LLPointer<LLImageFormatted> mImagep; LLPointer<LLImageFormatted> mImagep;
@@ -206,8 +208,9 @@ public:
} }
protected: protected:
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return webProfileResponders_timeout; }
/*virtual*/ bool redirect_status_ok(void) const { return true; } /*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"; }
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@@ -56,9 +56,10 @@ class LLEnvironmentRequestResponder: public LLHTTPClient::ResponderWithResult
{ {
LOG_CLASS(LLEnvironmentRequestResponder); LOG_CLASS(LLEnvironmentRequestResponder);
public: public:
virtual void result(const LLSD& content); /*virtual*/ void result(const LLSD& content);
virtual void error(U32 status, const std::string& reason); /*virtual*/ void error(U32 status, const std::string& reason);
virtual AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentRequestResponder_timeout; } /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return environmentRequestResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "LLEnvironmentRequestResponder"; }
private: private:
friend class LLEnvironmentRequest; friend class LLEnvironmentRequest;
@@ -80,7 +81,7 @@ private:
static clock_t UPDATE_WAIT_SECONDS; static clock_t UPDATE_WAIT_SECONDS;
}; };
class LLEnvironmentApplyResponder: public LLHTTPClient::ResponderWithResult class LLEnvironmentApplyResponder : public LLHTTPClient::ResponderWithResult
{ {
LOG_CLASS(LLEnvironmentApplyResponder); LOG_CLASS(LLEnvironmentApplyResponder);
public: public:
@@ -98,11 +99,12 @@ public:
* fail_reason : string * 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: private:
friend class LLEnvironmentApply; friend class LLEnvironmentApply;

View File

@@ -112,6 +112,7 @@ public:
/*virtual*/ void completed_headers(U32 status, std::string const& reason, AITransferInfo* info); /*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*/ 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*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return XMLRPCResponder_timeout; }
/*virtual*/ char const* getName(void) const { return "XMLRPCResponder"; }
}; };
#endif // LLXMLRPCRESPONDER_H #endif // LLXMLRPCRESPONDER_H

View File

@@ -69,22 +69,22 @@
<combo_item name="CurrentWindow" value="[i0,i0]"> <combo_item name="CurrentWindow" value="[i0,i0]">
Current Window Current Window
</combo_item> </combo_item>
<combo_item name="500x500" value="[i500,i500]"> <combo_item name="500x500" value="[i630,i-2]">
500x500 (1:1) 500x500 (1:1)
</combo_item> </combo_item>
<combo_item name="500x375" value="[i500,i375]"> <combo_item name="500x375" value="[i840,i-2]">
500x375 (4:3) 500x375 (4:3)
</combo_item> </combo_item>
<combo_item name="500x350" value="[i500,i350]"> <combo_item name="500x350" value="[i900,i-2]">
500x350 (10:7) 500x350 (10:7)
</combo_item> </combo_item>
<combo_item name="500x313" value="[i500,i313]"> <combo_item name="500x313" value="[i1008,i-2]">
500x313 (16:10) 500x313 (16:10)
</combo_item> </combo_item>
<combo_item name="500x281" value="[i500,i281]"> <combo_item name="500x281" value="[i1120,i-2]">
500x281 (16:9) 500x281 (16:9)
</combo_item> </combo_item>
<combo_item name="500x250" value="[i500,i250]"> <combo_item name="500x250" value="[i1260,i-2]">
500x250 (2:1) 500x250 (2:1)
</combo_item> </combo_item>
<combo_item name="Custom" value="[i-1,i-1]"> <combo_item name="Custom" value="[i-1,i-1]">

View File

@@ -18,7 +18,9 @@
left="10" left="10"
right="-10" right="-10"
type="string" type="string"
word_wrap="true"/> word_wrap="true">
Type your message here.
</text_editor>
<check_box <check_box
follows="left|bottom" follows="left|bottom"
initial_value="true" initial_value="true"
@@ -46,6 +48,9 @@
name="post_btn" name="post_btn"
bottom_delta="0" bottom_delta="0"
width="100"/> width="100"/>
<string name="default_message">
Click on the 'snapshot' link above to see the larger original.
</string>
<string name="upload_message"> <string name="upload_message">
"Uploading..." "Uploading..."
</string> </string>