Changeset 10572 for source/ariba/overlay/messages/DHTMessage.cpp
- Timestamp:
- Jun 18, 2012, 1:40:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/messages/DHTMessage.cpp
r6919 r10572 8 8 vsznDefault(DHTMessage); 9 9 10 DHTMessage::DHTMessage() { 11 this->key.setLength(0); 12 this->ttl = 0; 13 this->replace = false; 14 } 10 DHTMessage::DHTMessage() : 11 ttl( 0 ), 12 replace( false ) 13 {} 15 14 16 DHTMessage::DHTMessage( const Data& key ) { 17 // calculate hash of key 18 this->hash = NodeID::sha1( key.getBuffer(), key.getLength() / 8 ); 19 this->key = key.clone(); 20 this->ttl = 0; 21 this->replace = false; 22 } 15 DHTMessage::DHTMessage( const Data& key ) : 16 ttl( 0 ), 17 replace( false ), 18 key( key.clone() ) 19 {} 23 20 24 DHTMessage::DHTMessage( const Data& key, const Data& value ) { 25 // calculate hash of key 26 this->hash = NodeID::sha1( key.getBuffer(), key.getLength() / 8 ); 27 this->key = key.clone(); 28 this->values.push_back( value.clone() ); 29 this->ttl = 0; 30 this->replace = false; 31 } 21 DHTMessage::DHTMessage( const Data& key, const Data& value ) : 22 ttl( 0 ), 23 replace( false ), 24 key( key.clone() ), 25 values(1, value.clone()) 26 {} 32 27 33 DHTMessage::DHTMessage( const Data& key, const vector<Data>& values ) { 34 this->hash = NodeID::sha1( key.getBuffer(), key.getLength() / 8 ); 35 this->key = key.clone(); 28 DHTMessage::DHTMessage( const Data& key, const vector<Data>& values ) : 29 ttl( 0 ), 30 replace( false ), 31 key( key.clone() ) 32 { 33 // preallocate enough room so we don't need to copy a lot 34 this->values.reserve(values.size()); 36 35 BOOST_FOREACH(const Data value, values ) 37 36 this->values.push_back( value.clone() ); 38 this->ttl = 0;39 this->replace = false;40 37 } 41 38
Note:
See TracChangeset
for help on using the changeset viewer.