Changeset 7744 for source/ariba


Ignore:
Timestamp:
Mar 11, 2010, 9:28:24 AM (14 years ago)
Author:
Christoph Mayer
Message:

-branch merge back

Location:
source/ariba
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/Makefile.am

    r7468 r7744  
    415415  utility/types/Locator.cpp \
    416416  utility/types/NodeID.cpp \
     417  utility/types/PeerID.cpp \
    417418  utility/types/OverlayParameterSet.cpp \
    418419  utility/types/QoSParameterSet.cpp \
     
    429430  utility/types/Locator.h \
    430431  utility/types/NodeID.h \
     432  utility/types/PeerID.h \
    431433  utility/types/OverlayParameterSet.h \
    432434  utility/types/QoSParameterSet.h \
  • source/ariba/communication/BaseCommunication.cpp

    r7496 r7744  
    3838
    3939#include "BaseCommunication.h"
     40
    4041#include "networkinfo/AddressDiscovery.h"
     42#include "ariba/utility/types/PeerID.h"
    4143
    4244#ifdef UNDERLAY_OMNET
     
    5254namespace ariba {
    5355namespace communication {
     56
     57using ariba::utility::PeerID;
    5458
    5559use_logging_cpp(BaseCommunication);
     
    100104        currentSeqnum = 0;
    101105
     106        // set local peer id
     107        localDescriptor.getPeerId() = PeerID::random();
     108        logging_info( "Using PeerID: " << localDescriptor.getPeerId() );
     109
    102110        // creating transports
    103111        logging_info( "Creating transports ..." );
     
    114122
    115123        logging_info( "Searching for local locators ..." );
    116         if(localDescriptor.getEndpoints().to_string().length() == 0)
    117                 AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() );
     124        /**
     125         * DONT DO THAT: if(localDescriptor.getEndpoints().to_string().length() == 0)
     126         * since addresses are used to initialize transport addresses
     127         */
     128        AddressDiscovery::discover_endpoints( localDescriptor.getEndpoints() );
    118129        logging_info( "Done. Local endpoints = " << localDescriptor.toString() );
    119130
     
    177188        AribaBaseMsg baseMsg( AribaBaseMsg::typeLinkRequest, linkid );
    178189        baseMsg.getLocalDescriptor() = localDescriptor;
     190        baseMsg.getRemoteDescriptor().getPeerId() = descriptor.getPeerId();
    179191
    180192        // serialize and send message
     
    338350                        logging_debug( "Received link open request" );
    339351
     352                        /// not the correct peer id-> skip request
     353                        if (!msg->getRemoteDescriptor().getPeerId().isUnspecified()
     354                                && msg->getRemoteDescriptor().getPeerId() != localDescriptor.getPeerId()) {
     355                                logging_info("Received link request for "
     356                                        << msg->getRemoteDescriptor().getPeerId().toString()
     357                                        << "but i'm "
     358                                        << localDescriptor.getPeerId()
     359                                        << ": Ignoring!");
     360                                break;
     361                        }
     362
    340363                        /// only answer the first request
    341364                        if (!queryRemoteLink(msg->getLocalLink()).isUnspecified()) {
  • source/ariba/communication/EndpointDescriptor.h

    r6919 r7744  
    4343#include <set>
    4444#include "ariba/utility/serialization.h"
     45#include "ariba/utility/types/PeerID.h"
    4546#include "ariba/utility/addressing/endpoint_set.hpp"
    4647
     
    5152using namespace std;
    5253using namespace ariba::addressing;
     54using ariba::utility::PeerID;
    5355
    5456class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE
     
    120122        }
    121123
     124        /// returns a reference to the peer id
     125        PeerID& getPeerId() {
     126                return peerId;
     127        }
     128
     129
     130        /// returns a reference to the constant peer id
     131        const PeerID& getPeerId() const {
     132                return peerId;
     133        }
    122134private:
    123135        endpoint_set endpoints;
     136        PeerID peerId;
    124137};
    125138
     
    127140
    128141sznBeginDefault( ariba::communication::EndpointDescriptor, X ){
    129         // serialize endpoints
     142
     143        // serialize peer id
     144        X && &peerId;
     145
     146        // serialize end-points
    130147        uint16_t len = endpoints.to_bytes_size();
    131148        X && len;
  • source/ariba/communication/networkinfo/AddressDiscovery.cpp

    r6919 r7744  
    107107                if (addr==NULL) continue;
    108108
     109                // ignore tun devices
     110                string device = string(i->ifa_name);
     111                if(device.find_first_of("tun") == 0) continue;
     112
    109113                if (addr->sa_family == AF_INET) {
    110114                        // look for ipv4
  • source/ariba/overlay/BaseOverlay.cpp

    r7532 r7744  
    135135                for (vector<ValueEntry>::iterator i = values.begin();
    136136                                i != values.end(); i++ )
    137                         if (i->is_ttl_elapsed()) i = values.erase(i);
     137                        if (i->is_ttl_elapsed()) i = values.erase(i)-1;
    138138        }
    139139};
     
    214214                        // found? yes-> delete entry
    215215                        if ( equals(entry.key, key) ) {
    216                                 i = entries.erase(i);
     216                                i = entries.erase(i)-1;
    217217                                return true;
    218218                        }
     
    233233                                        // value found? yes-> delete
    234234                                        if (equals(j->get_value(), value)) {
    235                                                 j = entry.values.erase(j);
     235                                                j = entry.values.erase(j)-1;
    236236                                                return true;
    237237                                        }
     
    252252                                // value found? yes-> delete
    253253                                if (j->is_ttl_elapsed())
    254                                         j = entry.values.erase(j);
     254                                        j = entry.values.erase(j)-1;
    255255                        }
    256256
    257                         if (entry.values.size()==0) i = entries.erase(i);
     257                        if (entry.values.size()==0) i = entries.erase(i)-1;
    258258                }
    259259        }
     
    19111911                        "in the overlay from service " + service.toString() );
    19121912
     1913        if(message == NULL) return;
     1914        message->setReleasePayload(false);
     1915
    19131916        OverlayInterface::NodeList nodes = overlayInterface->getKnownNodes(true);
    1914         OverlayInterface::NodeList::iterator i = nodes.begin();
    1915         for(; i != nodes.end(); i++ ) {
    1916                 if( *i == nodeId) continue; // don't send to ourselfs
    1917                 sendMessage( message, *i, service );
     1917        for(size_t i=0; i<nodes.size(); i++){
     1918                NodeID& id = nodes.at(i);
     1919                if(id == this->nodeId) continue; // don't send to ourselfs
     1920                if(i+1 == nodes.size()) message->setReleasePayload(true); // release payload on last send
     1921                sendMessage( message, id, service );
    19181922        }
    19191923}
  • source/ariba/overlay/modules/chord/Chord.cpp

    r6919 r7744  
    250250                logging_info("new routing neighbor: " << remote.toString()
    251251                                << " with link " << lnk.toString());
    252                 // replace with new link
    253                 if (item->info!=lnk && item->info.isUnspecified()==false)
    254                         baseoverlay.dropLink(item->info);
    255                 item->info = lnk;
     252
     253                // replace with new link if link is "better"
     254                if (item->info!=lnk && item->info.isUnspecified()==false) {
     255                        if (baseoverlay.compare( item->info, lnk ) == 1) {
     256                                logging_info("Replacing link due to concurrent link establishment.");
     257                                baseoverlay.dropLink(item->info);
     258                                item->info = lnk;
     259                        }
     260                } else {
     261                        item->info = lnk;
     262                }
    256263
    257264                // discover neighbors of new overlay neighbor
  • source/ariba/utility/addressing

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • source/ariba/utility/bootstrap/modules/bluetoothsdp

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • source/ariba/utility/bootstrap/modules/periodicbroadcast

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • source/ariba/utility/transport

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.