diff options
Diffstat (limited to 'linden/indra/llmessage/lllogtextmessage.cpp')
-rw-r--r-- | linden/indra/llmessage/lllogtextmessage.cpp | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/linden/indra/llmessage/lllogtextmessage.cpp b/linden/indra/llmessage/lllogtextmessage.cpp deleted file mode 100644 index c44d667..0000000 --- a/linden/indra/llmessage/lllogtextmessage.cpp +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /** | ||
2 | * @file lllogtextmessage.cpp | ||
3 | * @author Phoenix | ||
4 | * @date 2005-01-12 | ||
5 | * @brief Impelmentation of the text logger. | ||
6 | * | ||
7 | * $LicenseInfo:firstyear=2005&license=viewergpl$ | ||
8 | * | ||
9 | * Copyright (c) 2005-2008, Linden Research, Inc. | ||
10 | * | ||
11 | * Second Life Viewer Source Code | ||
12 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
13 | * to you under the terms of the GNU General Public License, version 2.0 | ||
14 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
15 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
16 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
18 | * | ||
19 | * There are special exceptions to the terms and conditions of the GPL as | ||
20 | * it is applied to this Source Code. View the full text of the exception | ||
21 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
22 | * online at http://secondlife.com/developers/opensource/flossexception | ||
23 | * | ||
24 | * By copying, modifying or distributing this software, you acknowledge | ||
25 | * that you have read and understood your obligations described above, | ||
26 | * and agree to abide by those obligations. | ||
27 | * | ||
28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
30 | * COMPLETENESS OR PERFORMANCE. | ||
31 | * $/LicenseInfo$ | ||
32 | */ | ||
33 | |||
34 | #include "linden_common.h" | ||
35 | #include "lllogtextmessage.h" | ||
36 | |||
37 | #include "message.h" | ||
38 | |||
39 | |||
40 | LLLogTextMessage::~LLLogTextMessage() | ||
41 | { | ||
42 | S32 queue_size = (S32)mQueue.size(); | ||
43 | if(queue_size > 0) | ||
44 | { | ||
45 | llwarns << "Deleting queus with messages still on it." << llendl; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | void LLLogTextMessage::log( | ||
50 | const LLUUID& from, | ||
51 | const LLUUID& to, | ||
52 | const char* mesg) | ||
53 | { | ||
54 | const F64 F64_ZERO = 0.0; | ||
55 | log(from, to, F64_ZERO, F64_ZERO, mesg); | ||
56 | } | ||
57 | |||
58 | void LLLogTextMessage::log( | ||
59 | const LLUUID& from, | ||
60 | F64 global_x, | ||
61 | F64 global_y, | ||
62 | const char* mesg) | ||
63 | { | ||
64 | log(from, LLUUID::null, global_x, global_y, mesg); | ||
65 | } | ||
66 | |||
67 | void LLLogTextMessage::log( | ||
68 | const LLUUID& from, | ||
69 | const LLUUID& to, | ||
70 | F64 global_x, | ||
71 | F64 global_y, | ||
72 | const char* mesg) | ||
73 | { | ||
74 | const S32 OVERHEAD = (2*sizeof(LLUUID))+(2*sizeof(F64))+(sizeof(S32)); | ||
75 | const U32 MAX_LOGS_PER_MSG = 100; | ||
76 | const U32 LOG_MTU = 4000; | ||
77 | LLLogTextMessageData data(from, to, global_x, global_y, mesg); | ||
78 | mQueue.push_back(data); | ||
79 | mPendingSize += (S32)(OVERHEAD + data.mMessage.size()); | ||
80 | if((mQueue.size() >= MAX_LOGS_PER_MSG) || (mPendingSize > (S32)LOG_MTU)) | ||
81 | { | ||
82 | flush(); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | void LLLogTextMessage::flush() | ||
87 | { | ||
88 | mPendingSize = 0; | ||
89 | if(mQueue.empty()) return; | ||
90 | LLMessageSystem* msg = gMessageSystem; | ||
91 | msg->newMessageFast(_PREHASH_LogTextMessage); | ||
92 | while(!mQueue.empty()) | ||
93 | { | ||
94 | LLLogTextMessageData data(mQueue.front()); | ||
95 | mQueue.pop_front(); | ||
96 | msg->nextBlockFast(_PREHASH_DataBlock); | ||
97 | msg->addUUIDFast(_PREHASH_FromAgentId, data.mFromID); | ||
98 | msg->addUUIDFast(_PREHASH_ToAgentId, data.mToID); | ||
99 | msg->addF64Fast(_PREHASH_GlobalX, data.mGlobalX); | ||
100 | msg->addF64Fast(_PREHASH_GlobalY, data.mGlobalY); | ||
101 | msg->addU32Fast(_PREHASH_Time, data.mTime); | ||
102 | msg->addStringFast(_PREHASH_Message, data.mMessage.c_str()); | ||
103 | } | ||
104 | |||
105 | // Try to make this reliable, but don't try too hard | ||
106 | msg->sendReliable(mDataserver, 3, TRUE, 0.f, NULL, NULL); | ||
107 | } | ||
108 | |||
109 | LLLogTextMessage::LLLogTextMessageData::LLLogTextMessageData( | ||
110 | const LLUUID& from, | ||
111 | const LLUUID& to, | ||
112 | const F64& global_x, | ||
113 | const F64& gloabl_y, | ||
114 | const char* message) : | ||
115 | mFromID(from), | ||
116 | mToID(to), | ||
117 | mGlobalX(global_x), | ||
118 | mGlobalY(gloabl_y), | ||
119 | mMessage(message) | ||
120 | { | ||
121 | mTime = (S32)time(NULL); | ||
122 | } | ||