diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llmessage/llpacketring.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llmessage/llpacketring.h')
-rw-r--r-- | linden/indra/llmessage/llpacketring.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llpacketring.h b/linden/indra/llmessage/llpacketring.h new file mode 100644 index 0000000..27b830e --- /dev/null +++ b/linden/indra/llmessage/llpacketring.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /** | ||
2 | * @file llpacketring.h | ||
3 | * @brief definition of LLPacketRing class for implementing a resend, | ||
4 | * drop, or delay in packet transmissions | ||
5 | * | ||
6 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLPACKETRING_H | ||
30 | #define LL_LLPACKETRING_H | ||
31 | |||
32 | #include <queue> | ||
33 | |||
34 | #include "llpacketbuffer.h" | ||
35 | #include "linked_lists.h" | ||
36 | #include "llhost.h" | ||
37 | #include "net.h" | ||
38 | #include "llthrottle.h" | ||
39 | |||
40 | |||
41 | class LLPacketRing | ||
42 | { | ||
43 | public: | ||
44 | LLPacketRing(); | ||
45 | ~LLPacketRing(); | ||
46 | |||
47 | void free(); | ||
48 | |||
49 | void dropPackets(U32); | ||
50 | void setDropPercentage (F32 percent_to_drop); | ||
51 | void setUseInThrottle(const BOOL use_throttle); | ||
52 | void setUseOutThrottle(const BOOL use_throttle); | ||
53 | void setInBandwidth(const F32 bps); | ||
54 | void setOutBandwidth(const F32 bps); | ||
55 | S32 receivePacket (S32 socket, char *datap); | ||
56 | S32 receiveFromRing (S32 socket, char *datap); | ||
57 | |||
58 | BOOL sendPacket(int h_socket, char * send_buffer, S32 buf_size, LLHost host); | ||
59 | |||
60 | inline LLHost getLastSender(); | ||
61 | |||
62 | S32 getAndResetActualInBits() { S32 bits = mActualBitsIn; mActualBitsIn = 0; return bits;} | ||
63 | S32 getAndResetActualOutBits() { S32 bits = mActualBitsOut; mActualBitsOut = 0; return bits;} | ||
64 | protected: | ||
65 | BOOL mUseInThrottle; | ||
66 | BOOL mUseOutThrottle; | ||
67 | |||
68 | // For simulating a lower-bandwidth connection - BPS | ||
69 | LLThrottle mInThrottle; | ||
70 | LLThrottle mOutThrottle; | ||
71 | |||
72 | S32 mActualBitsIn; | ||
73 | S32 mActualBitsOut; | ||
74 | S32 mMaxBufferLength; // How much data can we queue up before dropping data. | ||
75 | S32 mInBufferLength; // Current incoming buffer length | ||
76 | S32 mOutBufferLength; // Current outgoing buffer length | ||
77 | |||
78 | F32 mDropPercentage; // % of packets to drop | ||
79 | U32 mPacketsToDrop; // drop next n packets | ||
80 | |||
81 | std::queue<LLPacketBuffer *> mReceiveQueue; | ||
82 | std::queue<LLPacketBuffer *> mSendQueue; | ||
83 | |||
84 | LLHost mLastSender; | ||
85 | }; | ||
86 | |||
87 | |||
88 | inline LLHost LLPacketRing::getLastSender() | ||
89 | { | ||
90 | return mLastSender; | ||
91 | } | ||
92 | |||
93 | #endif | ||