Changeset 2532 for code/branches/bugger/src/network/TrafficControl.cc
- Timestamp:
- Dec 23, 2008, 11:15:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bugger/src/network/TrafficControl.cc
r2531 r2532 30 30 31 31 #include "synchronisable/Synchronisable.h" 32 #include "core/ConfigValueIncludes.h" 32 33 33 34 #include <cassert> … … 67 68 TrafficControl::TrafficControl() 68 69 { 70 RegisterRootObject(TrafficControl); 69 71 assert(instance_==0); 70 72 instance_=this; 71 targetSize = 1000;//5000bytes 73 // targetSize = 2500;//5000bytes 74 SetConfigValue ( targetSize, 28000./25. ); 72 75 } 73 76 … … 127 130 return; 128 131 } 129 130 void TrafficControl::processAck(unsigned int clientID, unsigned int gamestateID) 132 133 TrafficControl *TrafficControl::getInstance() 134 { 135 assert(instance_); 136 return instance_; 137 } 138 139 void TrafficControl::ack(unsigned int clientID, unsigned int gamestateID) 131 140 { 132 141 std::list<obj>::iterator itvec; // iterator to iterate through the acked objects … … 141 150 if(clientListPerm_[clientID].find((*itvec).objID) != clientListPerm_[clientID].end()) // check whether the obj already exists in our lists 142 151 { 143 clientListPerm_[clientID][(*itvec).objID].objID = gamestateID; 152 clientListPerm_[clientID][(*itvec).objID].objCurGS = gamestateID; 153 clientListPerm_[clientID][(*itvec).objID].objValueSched = 0; //set scheduling value back 144 154 } 145 155 else 146 156 { 157 assert(0); 147 158 clientListPerm_[clientID][(*itvec).objID].objCurGS = gamestateID; 148 159 clientListPerm_[clientID][(*itvec).objID].objID = (*itvec).objID; … … 225 236 // for(itvec = list.begin(); itvec!=list.end(), itvec++) 226 237 // { 227 // ittempgs.insert(itvec); 238 // ittempgs.insert(itvec);static 228 239 // } 229 240 } … … 236 247 { 237 248 unsigned int size=0; 238 std::list<obj>::iterator itvec ;249 std::list<obj>::iterator itvec, ittemp; 239 250 assert(!list->empty()); 240 itvec = list->begin(); 241 for(itvec = list->begin(); itvec != list->end() && size<targetsize; itvec++) 251 for(itvec = list->begin(); itvec != list->end();) 242 252 { 243 253 assert( (*itvec).objSize < 1000); 244 if ( size + (*itvec).objSize < targetsize ) 245 { 254 // COUT(0) << "==targetsize== " << targetsize << endl; 255 if ( ( size + (*itvec).objSize ) < targetsize ) 256 { 257 // COUT(0) << "no cut" << endl; 246 258 size += (*itvec).objSize;//objSize is given in bytes 259 ++itvec; 247 260 } 248 261 else 249 262 { 250 clientListPerm_[currentClientID][(*itvec).objID].objValueSched -= SCHED_PRIORITY_OFFSET; 263 // COUT(0) << "cut" << endl; 264 clientListPerm_[currentClientID][(*itvec).objID].objValueSched += SCHED_PRIORITY_OFFSET; // NOTE: SCHED_PRIORITY_OFFSET is negative 265 // ittemp = itvec; 251 266 list->erase(itvec++); 252 } 267 // itvec = ittemp; 268 } 269 // printList(list, currentClientID); 253 270 } 254 271 assert(!list->empty()); … … 339 356 340 357 //now we check, that the creator of an object always exists on a client 341 printList(list, clientID);358 // printList(list, clientID); 342 359 std::list<obj>::iterator itcreator; 343 360 for(itvec = list->begin(); itvec != list->end(); itvec++) … … 348 365 //now the cutting, work the same obj out in processobjectlist and copiedlist, compression rate muss noch festgelegt werden. 349 366 cut(list, targetSize); 350 printList(list, clientID);367 // printList(list, clientID); 351 368 //diese Funktion updateClientList muss noch gemacht werden 352 369 updateClientListTemp(list); … … 359 376 COUT(0) << "=========== Objectlist ===========" << endl; 360 377 for( it=list->begin(); it!=list->end(); it++) 361 COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << endl;378 COUT(0) << "ObjectID: " << (*it).objID << " creatorID: " << (*it).objCreatorID << " Priority: " << clientListPerm_[clientID][(*it).objID].objValuePerm + clientListPerm_[clientID][(*it).objID].objValueSched << " size: " << (*it).objSize << endl; 362 379 } 363 380
Note: See TracChangeset
for help on using the changeset viewer.