diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llmessage/llxfermanager.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llmessage/llxfermanager.cpp')
-rw-r--r-- | linden/indra/llmessage/llxfermanager.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/linden/indra/llmessage/llxfermanager.cpp b/linden/indra/llmessage/llxfermanager.cpp index e08acd9..47c950b 100644 --- a/linden/indra/llmessage/llxfermanager.cpp +++ b/linden/indra/llmessage/llxfermanager.cpp | |||
@@ -90,8 +90,9 @@ void LLXferManager::free () | |||
90 | { | 90 | { |
91 | LLXfer *xferp; | 91 | LLXfer *xferp; |
92 | LLXfer *delp; | 92 | LLXfer *delp; |
93 | 93 | ||
94 | mOutgoingHosts.deleteAllData(); | 94 | for_each(mOutgoingHosts.begin(), mOutgoingHosts.end(), DeletePointer()); |
95 | mOutgoingHosts.clear(); | ||
95 | 96 | ||
96 | delp = mSendList; | 97 | delp = mSendList; |
97 | while (delp) | 98 | while (delp) |
@@ -155,12 +156,15 @@ void LLXferManager::updateHostStatus() | |||
155 | LLXfer *xferp; | 156 | LLXfer *xferp; |
156 | LLHostStatus *host_statusp = NULL; | 157 | LLHostStatus *host_statusp = NULL; |
157 | 158 | ||
158 | mOutgoingHosts.deleteAllData(); | 159 | for_each(mOutgoingHosts.begin(), mOutgoingHosts.end(), DeletePointer()); |
160 | mOutgoingHosts.clear(); | ||
159 | 161 | ||
160 | for (xferp = mSendList; xferp; xferp = xferp->mNext) | 162 | for (xferp = mSendList; xferp; xferp = xferp->mNext) |
161 | { | 163 | { |
162 | for (host_statusp = mOutgoingHosts.getFirstData(); host_statusp; host_statusp = mOutgoingHosts.getNextData()) | 164 | for (status_list_t::iterator iter = mOutgoingHosts.begin(); |
165 | iter != mOutgoingHosts.end(); ++iter) | ||
163 | { | 166 | { |
167 | host_statusp = *iter; | ||
164 | if (host_statusp->mHost == xferp->mRemoteHost) | 168 | if (host_statusp->mHost == xferp->mRemoteHost) |
165 | { | 169 | { |
166 | break; | 170 | break; |
@@ -172,7 +176,7 @@ void LLXferManager::updateHostStatus() | |||
172 | if (host_statusp) | 176 | if (host_statusp) |
173 | { | 177 | { |
174 | host_statusp->mHost = xferp->mRemoteHost; | 178 | host_statusp->mHost = xferp->mRemoteHost; |
175 | mOutgoingHosts.addData(host_statusp); | 179 | mOutgoingHosts.push_front(host_statusp); |
176 | } | 180 | } |
177 | } | 181 | } |
178 | if (host_statusp) | 182 | if (host_statusp) |
@@ -195,12 +199,14 @@ void LLXferManager::updateHostStatus() | |||
195 | void LLXferManager::printHostStatus() | 199 | void LLXferManager::printHostStatus() |
196 | { | 200 | { |
197 | LLHostStatus *host_statusp = NULL; | 201 | LLHostStatus *host_statusp = NULL; |
198 | if (mOutgoingHosts.getFirstData()) | 202 | if (!mOutgoingHosts.empty()) |
199 | { | 203 | { |
200 | llinfos << "Outgoing Xfers:" << llendl; | 204 | llinfos << "Outgoing Xfers:" << llendl; |
201 | 205 | ||
202 | for (host_statusp = mOutgoingHosts.getFirstData(); host_statusp; host_statusp = mOutgoingHosts.getNextData()) | 206 | for (status_list_t::iterator iter = mOutgoingHosts.begin(); |
207 | iter != mOutgoingHosts.end(); ++iter) | ||
203 | { | 208 | { |
209 | host_statusp = *iter; | ||
204 | llinfos << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << llendl; | 210 | llinfos << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << llendl; |
205 | } | 211 | } |
206 | } | 212 | } |
@@ -275,8 +281,10 @@ S32 LLXferManager::numPendingXfers(const LLHost &host) | |||
275 | { | 281 | { |
276 | LLHostStatus *host_statusp = NULL; | 282 | LLHostStatus *host_statusp = NULL; |
277 | 283 | ||
278 | for (host_statusp = mOutgoingHosts.getFirstData(); host_statusp; host_statusp = mOutgoingHosts.getNextData()) | 284 | for (status_list_t::iterator iter = mOutgoingHosts.begin(); |
285 | iter != mOutgoingHosts.end(); ++iter) | ||
279 | { | 286 | { |
287 | host_statusp = *iter; | ||
280 | if (host_statusp->mHost == host) | 288 | if (host_statusp->mHost == host) |
281 | { | 289 | { |
282 | return (host_statusp->mNumPending); | 290 | return (host_statusp->mNumPending); |
@@ -291,8 +299,10 @@ S32 LLXferManager::numActiveXfers(const LLHost &host) | |||
291 | { | 299 | { |
292 | LLHostStatus *host_statusp = NULL; | 300 | LLHostStatus *host_statusp = NULL; |
293 | 301 | ||
294 | for (host_statusp = mOutgoingHosts.getFirstData(); host_statusp; host_statusp = mOutgoingHosts.getNextData()) | 302 | for (status_list_t::iterator iter = mOutgoingHosts.begin(); |
303 | iter != mOutgoingHosts.end(); ++iter) | ||
295 | { | 304 | { |
305 | host_statusp = *iter; | ||
296 | if (host_statusp->mHost == host) | 306 | if (host_statusp->mHost == host) |
297 | { | 307 | { |
298 | return (host_statusp->mNumActive); | 308 | return (host_statusp->mNumActive); |
@@ -307,8 +317,10 @@ void LLXferManager::changeNumActiveXfers(const LLHost &host, S32 delta) | |||
307 | { | 317 | { |
308 | LLHostStatus *host_statusp = NULL; | 318 | LLHostStatus *host_statusp = NULL; |
309 | 319 | ||
310 | for (host_statusp = mOutgoingHosts.getFirstData(); host_statusp; host_statusp = mOutgoingHosts.getNextData()) | 320 | for (status_list_t::iterator iter = mOutgoingHosts.begin(); |
321 | iter != mOutgoingHosts.end(); ++iter) | ||
311 | { | 322 | { |
323 | host_statusp = *iter; | ||
312 | if (host_statusp->mHost == host) | 324 | if (host_statusp->mHost == host) |
313 | { | 325 | { |
314 | host_statusp->mNumActive += delta; | 326 | host_statusp->mNumActive += delta; |
@@ -1010,15 +1022,15 @@ void LLXferManager::startPendingDownloads() | |||
1010 | // stateful iteration, it would be possible for old requests to | 1022 | // stateful iteration, it would be possible for old requests to |
1011 | // never start. | 1023 | // never start. |
1012 | LLXfer* xferp = mReceiveList; | 1024 | LLXfer* xferp = mReceiveList; |
1013 | LLLinkedList<LLXfer> pending_downloads; | 1025 | std::list<LLXfer*> pending_downloads; |
1014 | S32 download_count = 0; | 1026 | S32 download_count = 0; |
1015 | S32 pending_count = 0; | 1027 | S32 pending_count = 0; |
1016 | while(xferp) | 1028 | while(xferp) |
1017 | { | 1029 | { |
1018 | if(xferp->mStatus == e_LL_XFER_PENDING) | 1030 | if(xferp->mStatus == e_LL_XFER_PENDING) |
1019 | { | 1031 | { |
1020 | ++pending_count; // getLength() is O(N), so track it here. | 1032 | ++pending_count; |
1021 | pending_downloads.addData(xferp); | 1033 | pending_downloads.push_front(xferp); |
1022 | } | 1034 | } |
1023 | else if(xferp->mStatus == e_LL_XFER_IN_PROGRESS) | 1035 | else if(xferp->mStatus == e_LL_XFER_IN_PROGRESS) |
1024 | { | 1036 | { |
@@ -1036,16 +1048,18 @@ void LLXferManager::startPendingDownloads() | |||
1036 | if((start_count > 0) && (pending_count > 0)) | 1048 | if((start_count > 0) && (pending_count > 0)) |
1037 | { | 1049 | { |
1038 | S32 result; | 1050 | S32 result; |
1039 | xferp = pending_downloads.getFirstData(); | 1051 | for (std::list<LLXfer*>::iterator iter = pending_downloads.begin(); |
1040 | while(start_count-- && xferp) | 1052 | iter != pending_downloads.end(); ++iter) |
1041 | { | 1053 | { |
1054 | xferp = *iter; | ||
1055 | if (start_count-- <= 0) | ||
1056 | break; | ||
1042 | result = xferp->startDownload(); | 1057 | result = xferp->startDownload(); |
1043 | if(result) | 1058 | if(result) |
1044 | { | 1059 | { |
1045 | xferp->abort(result); | 1060 | xferp->abort(result); |
1046 | ++start_count; | 1061 | ++start_count; |
1047 | } | 1062 | } |
1048 | xferp = pending_downloads.getNextData(); | ||
1049 | } | 1063 | } |
1050 | } | 1064 | } |
1051 | } | 1065 | } |