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

-branch merge back

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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()) {
Note: See TracChangeset for help on using the changeset viewer.