Routine V3 merge.

This commit is contained in:
Shyotl
2012-01-29 01:25:39 -06:00
parent f5818b7621
commit 6c921ba340
14 changed files with 148 additions and 103 deletions

View File

@@ -162,6 +162,7 @@ void LLMemory::logMemoryInfo(BOOL update)
if(update)
{
updateMemoryInfo() ;
LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ;
}
llinfos << "Current allocated physical memory(KB): " << sAllocatedMemInKB << llendl ;

View File

@@ -1,31 +1,25 @@
/**
* @file lleconomy.cpp
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* 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, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library 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
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -54,6 +48,31 @@ LLGlobalEconomy::LLGlobalEconomy()
LLGlobalEconomy::~LLGlobalEconomy()
{ }
void LLGlobalEconomy::addObserver(LLEconomyObserver* observer)
{
mObservers.push_back(observer);
}
void LLGlobalEconomy::removeObserver(LLEconomyObserver* observer)
{
std::list<LLEconomyObserver*>::iterator it =
std::find(mObservers.begin(), mObservers.end(), observer);
if (it != mObservers.end())
{
mObservers.erase(it);
}
}
void LLGlobalEconomy::notifyObservers()
{
for (std::list<LLEconomyObserver*>::iterator it = mObservers.begin();
it != mObservers.end();
++it)
{
(*it)->onEconomyDataChange();
}
}
// static
void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data)
{
@@ -94,6 +113,8 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy*
econ_data->setTeleportPriceExponent(f);
msg->getS32Fast(_PREHASH_Info, _PREHASH_PriceGroupCreate, i);
econ_data->setPriceGroupCreate(i);
econ_data->notifyObservers();
}
S32 LLGlobalEconomy::calculateTeleportCost(F32 distance) const

View File

@@ -1,31 +1,25 @@
/**
* @file lleconomy.h
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* 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, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library 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
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,6 +31,16 @@
class LLMessageSystem;
class LLVector3;
/**
* Register an observer to be notified of economy data updates coming from server.
*/
class LLEconomyObserver
{
public:
virtual ~LLEconomyObserver() {}
virtual void onEconomyDataChange() = 0;
};
class LLGlobalEconomy
{
public:
@@ -52,6 +56,10 @@ public:
virtual void print();
void addObserver(LLEconomyObserver* observer);
void removeObserver(LLEconomyObserver* observer);
void notifyObservers();
static void processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* econ_data);
S32 calculateTeleportCost(F32 distance) const;
@@ -95,6 +103,8 @@ private:
S32 mTeleportMinPrice;
F32 mTeleportPriceExponent;
S32 mPriceGroupCreate;
std::list<LLEconomyObserver*> mObservers;
};

View File

@@ -30,8 +30,8 @@
* $/LicenseInfo$
*/
#include "linden_common.h"
#include <iostream>
#include "linden_common.h"
#include "llsaleinfo.h"

View File

@@ -128,6 +128,7 @@ LLHTTPAssetRequest::LLHTTPAssetRequest(LLHTTPAssetStorage *asp,
: LLAssetRequest(uuid, type),
mZInitialized(false)
{
memset(&mZStream, 0, sizeof(mZStream)); // we'll initialize this later, but for now zero the whole C-style struct to avoid debug/coverity noise
mAssetStoragep = asp;
mCurlHandle = NULL;
mCurlMultiHandle = curl_multi;

View File

@@ -34,7 +34,7 @@
#define LL_HTTPCLIENTADAPTER_H
#include "llhttpclientinterface.h"
#include "llmemory.h" // LLSingleton<>
#include "llsingleton.h" // LLSingleton<>
class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton<LLHTTPClientAdapter>
{

View File

@@ -4,31 +4,25 @@
* @date 2005-10-05
* @brief Implementation of the http server classes
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* 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, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library 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
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -972,7 +966,9 @@ private:
// static
LLHTTPNode& LLIOHTTPServer::create(LLPumpIO& pump, U16 port)
{
LLSocket::ptr_t socket = LLSocket::create(LLSocket::STREAM_TCP, port);
LLSocket::ptr_t socket = LLSocket::create(
LLSocket::STREAM_TCP,
port);
if(!socket)
{
llerrs << "Unable to initialize socket" << llendl;

View File

@@ -114,11 +114,21 @@ LLSocket::ptr_t LLSocket::create(EType type, U16 port)
if(STREAM_TCP == type)
{
status = apr_socket_create(&rv->mSocket, APR_INET, SOCK_STREAM, APR_PROTO_TCP, rv->mPool());
status = apr_socket_create(
&rv->mSocket,
APR_INET,
SOCK_STREAM,
APR_PROTO_TCP,
rv->mPool());
}
else if(DATAGRAM_UDP == type)
{
status = apr_socket_create(&rv->mSocket, APR_INET, SOCK_DGRAM, APR_PROTO_UDP, rv->mPool());
status = apr_socket_create(
&rv->mSocket,
APR_INET,
SOCK_DGRAM,
APR_PROTO_UDP,
rv->mPool());
}
else
{

View File

@@ -239,15 +239,23 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap)
// no delay, pull straight from net
if (LLSocks::isEnabled())
{
proxywrap_t * header;
datap = datap-10;
header = (proxywrap_t *)datap;
packet_size = receive_packet(socket, datap);
mLastSender.setAddress(header->addr);
mLastSender.setPort(ntohs(header->port));
if (packet_size > 10)
const U8 SOCKS_HEADER_SIZE = 10;
U8 buffer[NET_BUFFER_SIZE + SOCKS_HEADER_SIZE];
packet_size = receive_packet(socket, static_cast<char*>(static_cast<void*>(buffer)));
if (packet_size > SOCKS_HEADER_SIZE)
{
packet_size -= 10;
// *FIX We are assuming ATYP is 0x01 (IPv4), not 0x03 (hostname) or 0x04 (IPv6)
memcpy(datap, buffer + SOCKS_HEADER_SIZE, packet_size - SOCKS_HEADER_SIZE);
proxywrap_t * header = static_cast<proxywrap_t*>(static_cast<void*>(buffer));
mLastSender.setAddress(header->addr);
mLastSender.setPort(ntohs(header->port));
packet_size -= SOCKS_HEADER_SIZE; // The unwrapped packet size
}
else
{
packet_size = 0;
}
}
else
@@ -285,7 +293,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
if (!mUseOutThrottle)
{
return doSendPacket(h_socket, send_buffer, buf_size, host );
return sendPacketImpl(h_socket, send_buffer, buf_size, host );
}
else
{
@@ -306,7 +314,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
mOutBufferLength -= packetp->getSize();
packet_size = packetp->getSize();
status = doSendPacket(h_socket, packetp->getData(), packet_size, packetp->getHost());
status = sendPacketImpl(h_socket, packetp->getData(), packet_size, packetp->getHost());
delete packetp;
// Update the throttle
@@ -315,7 +323,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
else
{
// If the queue's empty, we can just send this packet right away.
status = doSendPacket(h_socket, send_buffer, buf_size, host );
status = sendPacketImpl(h_socket, send_buffer, buf_size, host );
packet_size = buf_size;
// Update the throttle
@@ -354,7 +362,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL
return status;
}
BOOL LLPacketRing::doSendPacket(int h_socket, const char * send_buffer, S32 buf_size, LLHost host)
BOOL LLPacketRing::sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host)
{
if (!LLSocks::isEnabled())
@@ -362,14 +370,21 @@ BOOL LLPacketRing::doSendPacket(int h_socket, const char * send_buffer, S32 buf_
return send_packet(h_socket, send_buffer, buf_size, host.getAddress(), host.getPort());
}
proxywrap_t *socks_header = (proxywrap_t *)&mProxyWrappedSendBuffer;
const U8 SOCKS_HEADER_SIZE = 10;
char headered_send_buffer[NET_BUFFER_SIZE + SOCKS_HEADER_SIZE];
proxywrap_t *socks_header = static_cast<proxywrap_t*>(static_cast<void*>(&headered_send_buffer));
socks_header->rsv = 0;
socks_header->addr = host.getAddress();
socks_header->port = htons(host.getPort());
socks_header->atype = ADDRESS_IPV4;
socks_header->frag = 0;
memcpy(mProxyWrappedSendBuffer+10, send_buffer, buf_size);
memcpy(headered_send_buffer + SOCKS_HEADER_SIZE, send_buffer, buf_size);
return send_packet(h_socket,(const char*) mProxyWrappedSendBuffer, buf_size+10, LLSocks::getInstance()->getUDPPproxy().getAddress(), LLSocks::getInstance()->getUDPPproxy().getPort());
return send_packet( h_socket,
headered_send_buffer,
buf_size + SOCKS_HEADER_SIZE,
LLSocks::getInstance()->getUDPPproxy().getAddress(),
LLSocks::getInstance()->getUDPPproxy().getPort());
}

View File

@@ -88,8 +88,8 @@ protected:
LLHost mLastSender;
LLHost mLastReceivingIF;
BOOL doSendPacket(int h_socket, const char * send_buffer, S32 buf_size, LLHost host);
U8 mProxyWrappedSendBuffer[NET_BUFFER_SIZE];
private:
BOOL sendPacketImpl(int h_socket, const char * send_buffer, S32 buf_size, LLHost host);
};

View File

@@ -297,9 +297,10 @@ S32 getElementSize(const LLSD& llsd)
case LLSD::TypeMap:
case LLSD::TypeArray:
case LLSD::TypeUndefined:
default: // TypeLLSDTypeEnd, TypeLLSDNumTypes, etc.
return 0;
}
return 0;
//return 0;
}
//virtual

View File

@@ -556,11 +556,11 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count, bool faked_message, U8 fak
S32 acks = 0;
S32 true_rcv_size = 0;
U8* buffer = mTrueReceiveBuffer.buffer;
U8* buffer = mTrueReceiveBuffer;
if(!faked_message)
{
mTrueReceiveSize = mPacketRing.receivePacket(mSocket, (char *)mTrueReceiveBuffer.buffer);
mTrueReceiveSize = mPacketRing.receivePacket(mSocket, (char *)mTrueReceiveBuffer);
receive_size = mTrueReceiveSize;
mLastSender = mPacketRing.getLastSender();
mLastReceivingIF = mPacketRing.getLastReceivingInterface();
@@ -635,7 +635,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count, bool faked_message, U8 fak
for(S32 i = 0; i < acks; ++i)
{
true_rcv_size -= sizeof(TPACKETID);
memcpy(&mem_id, &buffer[true_rcv_size], /* Flawfinder: ignore*/
memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/
sizeof(TPACKETID));
packet_id = ntohl(mem_id);
//LL_INFOS("Messaging") << "got ack: " << packet_id << llendl;
@@ -3405,7 +3405,7 @@ void LLMessageSystem::dumpPacketToLog()
{
S32 offset = cur_line_pos * 3;
snprintf(line_buffer + offset, sizeof(line_buffer) - offset,
"%02x ", mTrueReceiveBuffer.buffer[i]); /* Flawfinder: ignore */
"%02x ", mTrueReceiveBuffer[i]); /* Flawfinder: ignore */
cur_line_pos++;
if (cur_line_pos >= 16)
{

View File

@@ -778,18 +778,7 @@ private:
LLMessagePollInfo *mPollInfop;
U8 mEncodedRecvBuffer[MAX_BUFFER_SIZE];
// Push current alignment to stack and set alignment to 1 byte boundary
#pragma pack(push,1)
struct ReceiveBuffer_t
{
proxywrap_t header;
U8 buffer[MAX_BUFFER_SIZE];
} mTrueReceiveBuffer;
#pragma pack(pop) /* restore original alignment from stack */
U8 mTrueReceiveBuffer[MAX_BUFFER_SIZE];
S32 mTrueReceiveSize;
// Must be valid during decode

View File

@@ -39,7 +39,7 @@
#include "llhudtext.h"
#include "llhudicon.h"
#include "llinventory.h"
#include "llmemory.h"
#include "llrefcount.h"
#include "llmemtype.h"
#include "llprimitive.h"
#include "lluuid.h"
@@ -49,6 +49,7 @@
#include "v3dmath.h"
#include "v3math.h"
#include "llvertexbuffer.h"
#include "llbbox.h"
class LLAgent; // TODO: Get rid of this.
class LLAudioSource;