|
13 | 13 | *********************************************************************/ |
14 | 14 | CAPIHelp_Distributed::CAPIHelp_Distributed() |
15 | 15 | { |
16 | | - nRandomFront = 0; |
17 | | - nRandomBack = 0; |
18 | | - nUPFront = 0; |
19 | | - nUPBack = 0; |
20 | 16 | } |
21 | 17 | CAPIHelp_Distributed::~CAPIHelp_Distributed() |
22 | 18 | { |
@@ -81,37 +77,13 @@ bool CAPIHelp_Distributed::APIHelp_Distributed_RandomAddr(list<string>* pStl_Lis |
81 | 77 | } |
82 | 78 | else if (2 == nMode) |
83 | 79 | { |
84 | | - if (nRandomFront >= pStl_ListAddr->size()) |
85 | | - { |
86 | | - nRandomFront = 0; |
87 | | - } |
88 | | - unsigned int i = 0; |
89 | | - for (auto stl_ListIterator = pStl_ListAddr->begin(); stl_ListIterator != pStl_ListAddr->end(); stl_ListIterator++, i++) |
90 | | - { |
91 | | - if (nRandomFront == i) |
92 | | - { |
93 | | - bFound = true; |
94 | | - _tcsxcpy(ptszAddr, stl_ListIterator->c_str()); |
95 | | - break; |
96 | | - } |
97 | | - } |
| 80 | + bFound = true; |
| 81 | + _tcsxcpy(ptszAddr, pStl_ListAddr->front().c_str()); |
98 | 82 | } |
99 | 83 | else if (3 == nMode) |
100 | 84 | { |
101 | | - if (nRandomBack >= pStl_ListAddr->size()) |
102 | | - { |
103 | | - nRandomBack = 0; |
104 | | - } |
105 | | - unsigned int i = 0; |
106 | | - for (auto stl_ListIterator = pStl_ListAddr->rbegin(); stl_ListIterator != pStl_ListAddr->rend(); stl_ListIterator++, i++) |
107 | | - { |
108 | | - if (nRandomBack == i) |
109 | | - { |
110 | | - bFound = true; |
111 | | - _tcsxcpy(ptszAddr, stl_ListIterator->c_str()); |
112 | | - break; |
113 | | - } |
114 | | - } |
| 85 | + bFound = true; |
| 86 | + _tcsxcpy(ptszAddr, pStl_ListAddr->back().c_str()); |
115 | 87 | } |
116 | 88 |
|
117 | 89 | if (!bFound) |
@@ -377,37 +349,13 @@ bool CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(list<XENGINE_STORAGEBUC |
377 | 349 | } |
378 | 350 | else if (2 == nMode) |
379 | 351 | { |
380 | | - if (nUPFront >= stl_BuckSelect.size()) |
381 | | - { |
382 | | - nUPFront = 0; |
383 | | - } |
384 | | - unsigned int i = 0; |
385 | | - for (auto stl_ListIterator = stl_BuckSelect.begin(); stl_ListIterator != stl_BuckSelect.end(); stl_ListIterator++, i++) |
386 | | - { |
387 | | - if (nUPFront == i) |
388 | | - { |
389 | | - bFound = true; |
390 | | - *pSt_StorageBucket = *stl_ListIterator; |
391 | | - break; |
392 | | - } |
393 | | - } |
| 352 | + bFound = true; |
| 353 | + *pSt_StorageBucket = stl_BuckSelect.front(); |
394 | 354 | } |
395 | 355 | else if (3 == nMode) |
396 | 356 | { |
397 | | - if (nUPBack >= stl_BuckSelect.size()) |
398 | | - { |
399 | | - nUPBack = 0; |
400 | | - } |
401 | | - unsigned int i = 0; |
402 | | - for (auto stl_ListIterator = stl_BuckSelect.rbegin(); stl_ListIterator != stl_BuckSelect.rend(); stl_ListIterator++, i++) |
403 | | - { |
404 | | - if (nUPBack == i) |
405 | | - { |
406 | | - bFound = true; |
407 | | - *pSt_StorageBucket = *stl_ListIterator; |
408 | | - break; |
409 | | - } |
410 | | - } |
| 357 | + bFound = true; |
| 358 | + *pSt_StorageBucket = stl_BuckSelect.back(); |
411 | 359 | } |
412 | 360 |
|
413 | 361 | if (!bFound) |
|
0 commit comments