Last change
on this file since 9770 was 6919, checked in by mies, 15 years ago |
Fixed tons of warnings when using CXXFLAGS="-Wall"!
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6266] | 1 | #include "DHTMessage.h"
|
---|
| 2 |
|
---|
| 3 | #include<boost/foreach.hpp>
|
---|
| 4 |
|
---|
| 5 | namespace ariba {
|
---|
| 6 | namespace overlay {
|
---|
| 7 |
|
---|
| 8 | vsznDefault(DHTMessage);
|
---|
| 9 |
|
---|
| 10 | DHTMessage::DHTMessage() {
|
---|
| 11 | this->key.setLength(0);
|
---|
[6919] | 12 | this->ttl = 0;
|
---|
[6835] | 13 | this->replace = false;
|
---|
[6266] | 14 | }
|
---|
| 15 |
|
---|
| 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();
|
---|
[6919] | 20 | this->ttl = 0;
|
---|
[6835] | 21 | this->replace = false;
|
---|
[6266] | 22 | }
|
---|
| 23 |
|
---|
| 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();
|
---|
[6919] | 28 | this->values.push_back( value.clone() );
|
---|
| 29 | this->ttl = 0;
|
---|
[6835] | 30 | this->replace = false;
|
---|
[6266] | 31 | }
|
---|
| 32 |
|
---|
| 33 | DHTMessage::DHTMessage( const Data& key, const vector<Data>& values ) {
|
---|
[6919] | 34 | this->hash = NodeID::sha1( key.getBuffer(), key.getLength() / 8 );
|
---|
[6796] | 35 | this->key = key.clone();
|
---|
[6266] | 36 | BOOST_FOREACH(const Data value, values )
|
---|
[6919] | 37 | this->values.push_back( value.clone() );
|
---|
| 38 | this->ttl = 0;
|
---|
[6835] | 39 | this->replace = false;
|
---|
[6266] | 40 | }
|
---|
| 41 |
|
---|
| 42 | DHTMessage::~DHTMessage() {
|
---|
| 43 | this->key.release();
|
---|
| 44 | BOOST_FOREACH( Data& value, values ) value.release();
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | }}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.