Changeset 8807 for code/branches/output/src/libraries/network/packet
- Timestamp:
- Jul 31, 2011, 9:09:23 PM (13 years ago)
- Location:
- code/branches/output/src/libraries/network/packet
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/network/packet/Acknowledgement.cc
r8788 r8807 64 64 65 65 bool Acknowledgement::process(orxonox::Host* host){ 66 COUT(5) << "processing ACK with ID: " << getAckID() << endl;66 orxout(verbose_more, context::packets) << "processing ACK with ID: " << getAckID() << endl; 67 67 bool b = host->ackGamestate(getAckID(), peerID_); 68 68 delete this; -
code/branches/output/src/libraries/network/packet/ClassID.cc
r7801 r8807 92 92 assert(tempsize==packetSize); 93 93 94 COUT(5) << "classid packetSize is " << packetSize << endl;94 orxout(verbose_more, context::packets) << "classid packetSize is " << packetSize << endl; 95 95 96 96 } … … 131 131 Identifier::clearNetworkIDs(); 132 132 133 COUT(4) << "=== processing classids: " << endl;133 orxout(verbose, context::packets) << "=== processing classids: " << endl; 134 134 std::pair<uint32_t, std::string> tempPair; 135 135 Identifier *id; … … 143 143 classname = temp+2*sizeof(uint32_t); 144 144 id=ClassByString( std::string((const char*)classname) ); 145 COUT(3) << "processing classid: " << networkID << " name: " << classname << " id: " << id << std::endl;145 orxout(internal_info, context::packets) << "processing classid: " << networkID << " name: " << classname << " id: " << id << endl; 146 146 if(id==NULL){ 147 COUT(0) << "Received a bad classname" << endl;147 orxout(user_error, context::packets) << "Received a bad classname" << endl; 148 148 abort(); 149 149 } -
code/branches/output/src/libraries/network/packet/DeleteObjects.cc
r8788 r8807 62 62 if(number==0) 63 63 return false; 64 COUT(4) << "sending DeleteObjects: ";64 orxout(verbose, context::packets) << "sending DeleteObjects: "; 65 65 unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1); 66 66 data_ = new uint8_t[size]; … … 73 73 unsigned int temp = Synchronisable::popDeletedObject(); 74 74 *reinterpret_cast<uint32_t*>(tdata) = temp; 75 COUT(4) << temp << ' ';75 orxout(verbose, context::packets) << temp << ' '; 76 76 tdata += sizeof(uint32_t); 77 77 } 78 COUT(4) << std::endl;78 orxout(verbose, context::packets) << endl; 79 79 return true; 80 80 } … … 90 90 for(unsigned int i=0; i<*(unsigned int *)(data_+_QUANTITY); i++) 91 91 { 92 COUT(4) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << std::endl;92 orxout(verbose, context::packets) << "deleting object with id: " << *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) << endl; 93 93 Synchronisable::deleteObject( *(uint32_t*)(data_+_OBJECTIDS+i*sizeof(uint32_t)) ); 94 94 } -
code/branches/output/src/libraries/network/packet/FunctionIDs.cc
r8788 r8807 88 88 } 89 89 90 COUT(5) << "FunctionIDs packetSize is " << packetSize << endl;90 orxout(verbose_more, context::packets) << "FunctionIDs packetSize is " << packetSize << endl; 91 91 92 92 } … … 126 126 unsigned char *functionname; 127 127 128 COUT(4) << "=== processing functionids: " << endl;128 orxout(verbose, context::packets) << "=== processing functionids: " << endl; 129 129 std::pair<uint32_t, std::string> tempPair; 130 130 // read the total number of classes … … 137 137 stringsize = *(uint32_t*)(temp+sizeof(uint32_t)); 138 138 functionname = temp+2*sizeof(uint32_t); 139 COUT(3) << "processing functionid: " << networkID << " name: " << functionname << std::endl;139 orxout(internal_info, context::packets) << "processing functionid: " << networkID << " name: " << functionname << endl; 140 140 NetworkFunctionBase::setNetworkID((const char*)functionname, networkID); 141 141 temp += 2*sizeof(uint32_t) + stringsize; -
code/branches/output/src/libraries/network/packet/Gamestate.cc
r8788 r8807 108 108 uint32_t size = calcGamestateSize(id, mode); 109 109 110 COUT(5) << "G.ST.Man: producing gamestate with id: " << id << std::endl;110 orxout(verbose_more, context::packets) << "G.ST.Man: producing gamestate with id: " << id << endl; 111 111 if(size==0) 112 112 return false; … … 114 114 if(!data_) 115 115 { 116 COUT(2) << "GameStateManager: could not allocate memory" << std::endl;116 orxout(internal_warning, context::packets) << "GameStateManager: could not allocate memory" << endl; 117 117 return false; 118 118 } … … 139 139 assert(0); // if we don't use multithreading this part shouldn't be neccessary 140 140 // start allocate additional memory 141 COUT(3) << "Gamestate: need additional memory" << std::endl;141 orxout(internal_info, context::packets) << "Gamestate: need additional memory" << endl; 142 142 ObjectList<Synchronisable>::iterator temp = it; 143 143 uint32_t addsize=tempsize; … … 167 167 //stop write gamestate header 168 168 169 COUT(5) << "Gamestate: Gamestate size: " << currentsize << std::endl;170 COUT(5) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << std::endl;169 orxout(verbose_more, context::packets) << "Gamestate: Gamestate size: " << currentsize << endl; 170 orxout(verbose_more, context::packets) << "Gamestate: 'estimated' (and corrected) Gamestate size: " << size << endl; 171 171 return true; 172 172 } … … 175 175 bool Gamestate::spreadData(uint8_t mode) 176 176 { 177 COUT(5) << "processing gamestate with id " << header_.getID() << endl;177 orxout(verbose_more, context::packets) << "processing gamestate with id " << header_.getID() << endl; 178 178 assert(data_); 179 179 assert(!header_.isCompressed()); … … 195 195 else 196 196 { 197 // COUT(4) << "not creating object of classid " << objectheader.getClassID() << endl;197 // orxout(verbose, context::packets) << "not creating object of classid " << objectheader.getClassID() << endl; 198 198 mem += objectheader.getDataSize() + ( objectheader.isDiffed() ? SynchronisableHeaderLight::getSize() : SynchronisableHeader::getSize() ); 199 199 } … … 201 201 else 202 202 { 203 // COUT(4) << "updating object of classid " << objectheader.getClassID() << endl;203 // orxout(verbose, context::packets) << "updating object of classid " << objectheader.getClassID() << endl; 204 204 OrxVerify(s->updateData(mem, mode), "ERROR: could not update Synchronisable with Gamestate data"); 205 205 } … … 219 219 if (it->objectMode_ != 0x0) 220 220 { 221 COUT(0) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << std::endl;222 COUT(0) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << std::endl;223 COUT(0) << "Objects class: " << it->getIdentifier()->getName() << std::endl;221 orxout(user_error, context::packets) << "Found object with OBJECTID_UNKNOWN on the client with objectMode != 0x0!" << endl; 222 orxout(user_error, context::packets) << "Possible reason for this error: Client created a synchronized object without the Server's approval." << endl; 223 orxout(user_error, context::packets) << "Objects class: " << it->getIdentifier()->getName() << endl; 224 224 assert(false); 225 225 } … … 232 232 if (it->getObjectID() == *it2) 233 233 { 234 COUT(0) << "Found duplicate objectIDs on the client!" << std::endl235 << "Are you sure you don't create a Sychnronisable objcect with 'new' \236 that doesn't have objectMode = 0x0?" << std::endl;234 orxout(user_error, context::packets) << "Found duplicate objectIDs on the client!" << endl 235 << "Are you sure you don't create a Sychnronisable objcect with 'new' \ 236 that doesn't have objectMode = 0x0?" << endl; 237 237 assert(false); 238 238 } … … 293 293 switch ( retval ) 294 294 { 295 case Z_OK: COUT(5) << "G.St.Man: compress: successfully compressed" << std::endl; break;296 case Z_MEM_ERROR: COUT(1) << "G.St.Man: compress: not enough memory available in gamestate.compress" << std::endl; return false;297 case Z_BUF_ERROR: COUT(2) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << std::endl; return false;298 case Z_DATA_ERROR: COUT(2) << "G.St.Man: compress: data corrupted in gamestate.compress" << std::endl; return false;295 case Z_OK: orxout(verbose_more, context::packets) << "G.St.Man: compress: successfully compressed" << endl; break; 296 case Z_MEM_ERROR: orxout(internal_error, context::packets) << "G.St.Man: compress: not enough memory available in gamestate.compress" << endl; return false; 297 case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: not enough memory available in the buffer in gamestate.compress" << endl; return false; 298 case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "G.St.Man: compress: data corrupted in gamestate.compress" << endl; return false; 299 299 } 300 300 … … 310 310 header_.setCompSize( buffer ); 311 311 header_.setCompressed( true ); 312 COUT(4) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << std::endl;312 orxout(verbose, context::packets) << "gamestate compress datasize: " << header_.getDataSize() << " compsize: " << header_.getCompSize() << endl; 313 313 return true; 314 314 } … … 319 319 assert(data_); 320 320 assert(header_.isCompressed()); 321 COUT(4) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << std::endl;321 orxout(verbose, context::packets) << "GameStateClient: uncompressing gamestate. id: " << header_.getID() << ", baseid: " << header_.getBaseID() << ", datasize: " << header_.getDataSize() << ", compsize: " << header_.getCompSize() << endl; 322 322 uint32_t datasize = header_.getDataSize(); 323 323 uint32_t compsize = header_.getCompSize(); … … 333 333 switch ( retval ) 334 334 { 335 case Z_OK: COUT(5) << "successfully decompressed" << std::endl; break;336 case Z_MEM_ERROR: COUT(1) << "not enough memory available" << std::endl; return false;337 case Z_BUF_ERROR: COUT(2) << "not enough memory available in the buffer" << std::endl; return false;338 case Z_DATA_ERROR: COUT(2) << "data corrupted (zlib)" << std::endl; return false;335 case Z_OK: orxout(verbose_more, context::packets) << "successfully decompressed" << endl; break; 336 case Z_MEM_ERROR: orxout(internal_error, context::packets) << "not enough memory available" << endl; return false; 337 case Z_BUF_ERROR: orxout(internal_warning, context::packets) << "not enough memory available in the buffer" << endl; return false; 338 case Z_DATA_ERROR: orxout(internal_warning, context::packets) << "data corrupted (zlib)" << endl; return false; 339 339 } 340 340 … … 375 375 if( memcmp( origDataPtr+objectOffset, baseDataPtr+objectOffset, objectHeader.getDataSize()) == 0 ) 376 376 { 377 // COUT(4) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl;377 // orxout(verbose, context::packets) << "skip object " << Synchronisable::getSynchronisable(objectHeader.getObjectID())->getIdentifier()->getName() << endl; 378 378 origDataPtr += objectOffset + objectHeader.getDataSize(); // skip the whole object 379 379 baseDataPtr += objectOffset + objectHeader.getDataSize(); … … 431 431 inline void /*Gamestate::*/copyObject( uint8_t*& newData, uint8_t*& origData, uint8_t*& baseData, SynchronisableHeader& objectHeader, std::vector<uint32_t>::iterator& sizes ) 432 432 { 433 // COUT(4) << "docopy" << endl;433 // orxout(verbose, context::packets) << "docopy" << endl; 434 434 // Just copy over the whole Object 435 435 memcpy( newData, origData, objectHeader.getDataSize()+SynchronisableHeader::getSize() ); … … 440 440 // SynchronisableHeader baseHeader( baseData ); 441 441 // baseData += baseHeader.getDataSize()+SynchronisableHeader::getSize(); 442 // COUT(4) << "copy " << h.getObjectID() << endl;443 // COUT(4) << "copy " << h.getObjectID() << ":";442 // orxout(verbose, context::packets) << "copy " << h.getObjectID() << endl; 443 // orxout(verbose, context::packets) << "copy " << h.getObjectID() << ":"; 444 444 sizes += Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables(); 445 445 // for( unsigned int i = 0; i < Synchronisable::getSynchronisable(objectHeader.getObjectID())->getNrOfVariables(); ++i ) 446 446 // { 447 // // COUT(4) << " " << *sizes;447 // // orxout(verbose, context::packets) << " " << *sizes; 448 448 // ++sizes; 449 449 // } 450 // COUT(4) << endl;450 // orxout(verbose, context::packets) << endl; 451 451 } 452 452 … … 541 541 if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() ) 542 542 { 543 // COUT(4) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;543 // orxout(verbose, context::packets) << "diffing object in order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl; 544 544 diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt); 545 545 diffedObject = true; … … 547 547 else 548 548 { 549 // COUT(4) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;549 // orxout(verbose, context::packets) << "copy object because of different data sizes (1): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl; 550 550 copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt); 551 551 assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd); … … 565 565 if( SynchronisableHeader(baseDataPtr).getDataSize()==origHeader.getDataSize() ) 566 566 { 567 // COUT(4) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;567 // orxout(verbose, context::packets) << "diffing object out of order: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl; 568 568 diffObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt); 569 569 diffedObject = true; … … 571 571 else 572 572 { 573 // COUT(4) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;573 // orxout(verbose, context::packets) << "copy object because of different data sizes (2): " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl; 574 574 copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt); 575 575 assert(sizesIt != this->sizes_.end() || origDataPtr==origDataEnd); … … 578 578 else 579 579 { 580 // COUT(4) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl;580 // orxout(verbose, context::packets) << "copy object: " << Synchronisable::getSynchronisable(origHeader.getObjectID())->getIdentifier()->getName() << endl; 581 581 assert(baseDataPtr == oldBaseDataPtr); 582 582 copyObject(destDataPtr, origDataPtr, baseDataPtr, origHeader, sizesIt); … … 718 718 //copy in the zeros 719 719 // std::list<obj>::iterator itt; 720 // COUT(0) << "myvector contains:";720 // orxout() << "myvector contains:"; 721 721 // for ( itt=dataVector_.begin() ; itt!=dataVector_.end(); itt++ ) 722 // COUT(0) << " " << (*itt).objID;723 // COUT(0) << endl;722 // orxout() << " " << (*itt).objID; 723 // orxout() << endl; 724 724 for(it=dataVector_.begin(); it!=dataVector_.end();){ 725 725 SynchronisableHeader oldobjectheader(origdata); … … 771 771 nrOfVariables += it->getNrOfVariables(); 772 772 } 773 // COUT(0) << "allocating " << nrOfVariables << " ints" << endl;773 // orxout() << "allocating " << nrOfVariables << " ints" << endl; 774 774 this->sizes_.reserve(nrOfVariables); 775 775 return size; -
code/branches/output/src/libraries/network/packet/Packet.cc
r8788 r8807 192 192 // peerID = NETWORK_PEER_ID_SERVER; 193 193 Packet *p = 0; 194 // COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;194 // orxout(verbose_ultra, context::packets) << "packet type: " << *(Type::Value *)&data[_PACKETID] << endl; 195 195 switch( *(Type::Value *)(data + _PACKETID) ) 196 196 { 197 197 case Type::Acknowledgement: 198 // COUT(5) << "ack" << std::endl;198 // orxout(verbose_more, context::packets) << "ack" << endl; 199 199 p = new Acknowledgement( data, peerID ); 200 200 break; 201 201 case Type::Chat: 202 // COUT(5) << "chat" << std::endl;202 // orxout(verbose_more, context::packets) << "chat" << endl; 203 203 p = new Chat( data, peerID ); 204 204 break; 205 205 case Type::ClassID: 206 // COUT(5) << "classid" << std::endl;206 // orxout(verbose_more, context::packets) << "classid" << endl; 207 207 p = new ClassID( data, peerID ); 208 208 break; 209 209 case Type::Gamestate: 210 // COUT(5) << "gamestate" << std::endl;210 // orxout(verbose_more, context::packets) << "gamestate" << endl; 211 211 p = new Gamestate( data, peerID ); 212 212 break; 213 213 case Type::Welcome: 214 // COUT(5) << "welcome" << std::endl;214 // orxout(verbose_more, context::packets) << "welcome" << endl; 215 215 p = new Welcome( data, peerID ); 216 216 break; 217 217 case Type::DeleteObjects: 218 // COUT(5) << "deleteobjects" << std::endl;218 // orxout(verbose_more, context::packets) << "deleteobjects" << endl; 219 219 p = new DeleteObjects( data, peerID ); 220 220 break; 221 221 case Type::FunctionCalls: 222 // COUT(5) << "functionCalls" << std::endl;222 // orxout(verbose_more, context::packets) << "functionCalls" << endl; 223 223 p = new FunctionCalls( data, peerID ); 224 224 break; 225 225 case Type::FunctionIDs: 226 // COUT(5) << "functionIDs" << std::endl;226 // orxout(verbose_more, context::packets) << "functionIDs" << endl; 227 227 p = new FunctionIDs( data, peerID ); 228 228 break; … … 255 255 packetMap_.erase(it); 256 256 Packet::packetMapMutex_.unlock(); 257 // COUT(6) << "PacketMap size: " << packetMap_.size() << std::endl;257 // orxout(verbose_ultra, context::packets) << "PacketMap size: " << packetMap_.size() << endl; 258 258 } 259 259 -
code/branches/output/src/libraries/network/packet/Welcome.cc
r8788 r8807 78 78 assert(*(uint32_t *)(data_ + _ENDIANTEST ) == 0xFEDC4321); 79 79 host->setClientID(clientID); 80 COUT(3) << "Welcome set clientId: " << clientID << endl;80 orxout(internal_info, context::packets) << "Welcome set clientId: " << clientID << endl; 81 81 Synchronisable::setClient(true); 82 82 delete this;
Note: See TracChangeset
for help on using the changeset viewer.