Changeset 2454


Ignore:
Timestamp:
Feb 18, 2009, 1:39:08 PM (15 years ago)
Author:
mies
Message:

fixed some bugs

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • etc/pingpong/settings_initiator.cnf

    r2452 r2454  
    44ariba.tcp.port = 5002
    55#ariba.udp.port =
    6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,5002)}
     6ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})}
  • etc/pingpong/settings_node1.cnf

    r2452 r2454  
    44ariba.tcp.port = 5003
    55#ariba.udp.port =
    6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,5002)}
     6ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})}
     7
  • etc/pingpong/settings_node2.cnf

    r2452 r2454  
    44ariba.tcp.port = 5010
    55#ariba.udp.port =
    6 ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,5002)}
     6ariba.bootstrap.hints=pingpong{ip{127.0.0.1},tcp(ip,{5002})}
     7
  • source/ariba/AribaModule.cpp

    r2452 r2454  
    5858namespace ariba {
    5959
    60 AribaModule::BootstrapNode::~BootstrapNode() {
    61         if (desc!=NULL) delete desc;
    62 }
    63 
    6460AribaModule::AribaModule() {
    6561
     
    8581                        i++;
    8682                }
     83                o << "}";
    8784        }
    8885        return o.str();
     
    10299                        string data = nav[i][robject_data].str();
    103100                        data = data.substr(1, data.size() - 2);
    104                         Name name = type;
     101                        Name name(type);
    105102                        EndpointDescriptor* desc = EndpointDescriptor::fromString(data);
    106103                        addBootstrapNode(name, desc);
  • source/ariba/AribaModule.h

    r2452 r2454  
    141141        class BootstrapNode {
    142142        public:
    143                 inline BootstrapNode() : timestamp(0), desc(NULL) {
     143                inline BootstrapNode() :
     144                        timestamp(0), desc(NULL) {
    144145
     146                }
     147                inline BootstrapNode(const BootstrapNode& copy) :
     148                        timestamp(copy.timestamp), desc(copy.desc) {
    145149                }
    146150                inline BootstrapNode(uint32_t timestamp,
    147151                                communication::EndpointDescriptor* desc) :
    148152                        timestamp(timestamp), desc(desc) {
    149 
    150153                }
    151                 ~BootstrapNode();
    152154                uint32_t timestamp;
    153155                communication::EndpointDescriptor* desc;
     
    157159        class BootstrapInfo {
    158160        public:
     161                BootstrapInfo() :
     162                        spovnetName(), nodes() {
     163
     164                }
     165
     166                BootstrapInfo(const BootstrapInfo& copy) :
     167                        spovnetName(copy.spovnetName), nodes(copy.nodes) {
     168
     169                }
     170
    159171                Name spovnetName;
    160172                vector<BootstrapNode> nodes;
  • source/ariba/Name.cpp

    r2437 r2454  
    6262        if (copy) {
    6363
    64                 if ((name!=NULL) && (len>0)){
     64                if ( (name!=NULL) && (len>0) ){
    6565                        _bytes = new uint8_t[len];
    6666                        memcpy( _bytes, name, len );
    6767                } else {
    6868                        len = 0;
    69                         _bytes = NULL; 
     69                        _bytes = NULL;
    7070                }
    7171
     
    7979}
    8080
    81 Name::Name() 
     81Name::Name()
    8282        : _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
    8383}
    8484
    85 Name::Name(const char* name, int len, bool copy) 
     85Name::Name(const char* name, int len, bool copy)
    8686        : _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
    8787        init(name, len, copy, len == -1);
    8888}
    8989
    90 Name::Name(string name) 
     90Name::Name(string name)
    9191        : _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
    9292        init(name.c_str(), name.length(), true, true);
    9393}
    9494
    95 Name::Name(const Name& name) 
     95Name::Name(const Name& name)
    9696        : _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
    9797        init((const char*)name.bytes(), name.length(), true, name._hreadable);
     
    104104                _length = 0;
    105105        }
     106}
     107
     108Name& Name::operator=( const Name& name ) {
     109        init((const char*)name.bytes(), name.length(), true, name._hreadable);
    106110}
    107111
     
    119123        if (_bytes == NULL && name._bytes == NULL &&
    120124                length() == name.length()) return true;
    121        
     125
    122126        // specified name objects
    123127        if (_bytes == NULL || name._bytes == NULL) return false;
  • source/ariba/Name.h

    r2437 r2454  
    113113
    114114        /**
     115         * The common assign operator
     116         */
     117        Name& operator=( const Name& name );
     118
     119        /**
    115120         * The common implementation of the "equal" operator.
    116121         */
  • source/ariba/Node.cpp

    r2439 r2454  
    4545#include "ariba/interface/ServiceInterface.h"
    4646#include "ariba/interface/UnderlayAbstraction.h"
    47 
     47#include "ariba/communication/EndpointDescriptor.h"
     48
     49using ariba::communication::EndpointDescriptor;
    4850using ariba::interface::UnderlayAbstraction;
    4951
     
    125127
    126128Node::Node(AribaModule& ariba_mod, const Name& node_name) :
    127         ariba_mod( ariba_mod ), name( node_name ), context( NULL ){
     129        ariba_mod(ariba_mod), name(node_name), context(NULL) {
    128130}
    129131
     
    133135void Node::join(const Name& vnetname) {
    134136        spovnetId = vnetname.toSpoVNetId();
    135         nodeId = generateNodeId( name );
     137        nodeId = generateNodeId(name);
    136138        this->context = ariba_mod.underlay_abs->joinSpoVNet(spovnetId,
    137139                        *ariba_mod.getBootstrapNode(name), nodeId);
     
    139141
    140142void Node::initiate(const Name& vnetname, const SpoVNetProperties& parm) {
    141         utility::OverlayParameterSet ovrpset =
    142                 (utility::OverlayParameterSet::_OverlayStructure) parm.getBaseOverlayType();
     143        utility::OverlayParameterSet
     144                        ovrpset =
     145                                        (utility::OverlayParameterSet::_OverlayStructure) parm.getBaseOverlayType();
    143146        spovnetId = vnetname.toSpoVNetId();
    144         nodeId = generateNodeId( name );
     147        nodeId = generateNodeId(name);
    145148        this->context = ariba_mod.underlay_abs->createSpoVNet(spovnetId, nodeId,
    146149                        ariba_mod.ip_addr, ariba_mod.tcp_port);
     150        ariba_mod.addBootstrapNode(vnetname,
     151                        new EndpointDescriptor(this->context->getBaseCommunication().getEndpointDescriptor()));
    147152}
    148153
     
    173178
    174179NodeID Node::generateNodeId(const Name& name) const {
    175         if( name == Name::UNSPECIFIED )
    176                 return Name::random().toNodeId();
    177         else
    178                 return name.toNodeId();
     180        if (name == Name::UNSPECIFIED) return Name::random().toNodeId();
     181        else return name.toNodeId();
    179182}
    180183
     
    190193seqnum_t Node::sendMessage(const DataMessage& msg, const NodeID& nid,
    191194                const ServiceID& sid, const LinkProperties& req) {
    192         return context->getOverlay().sendMessage((Message*)msg, nid, sid);
     195        return context->getOverlay().sendMessage((Message*) msg, nid, sid);
    193196}
    194197
    195198seqnum_t Node::sendMessage(const DataMessage& msg, const LinkID& lnk) {
    196         return context->getOverlay().sendMessage((Message*)msg, lnk);
     199        return context->getOverlay().sendMessage((Message*) msg, lnk);
    197200}
    198201
  • source/ariba/communication/EndpointDescriptor.cpp

    r2452 r2454  
    9292                                string ip = nav[i][robject_data].str();
    9393                                ip = ip.substr(1,ip.size()-2);
    94                                 cout << "ep-ip = " <<ip << endl;
     94                                cout << "ep-ip = " << ip << endl;
    9595                                ep = new EndpointDescriptor();
    9696                                ep->locator = new IPv4Locator();
     97                                cout << "1" << endl;
    9798                                ep->locator->setIP(ip);
     99                                cout << "2" << endl;
    98100                                ep->isUnspec = false;
     101                                cout << "3" << endl;
    99102                        } else
    100103                        if (type=="tcp") {
     104                                cout << "4" << endl;
    101105                                string port = nav[i][robject_data][rfields][1].str();
    102106                                port = port.substr(1,port.size()-2);
    103107                                cout << "ep-tcp-port = " << port << endl;
     108                                cout << "5" << endl;
    104109                                ep->locator->setPort(stoi(port));
    105110                        }
Note: See TracChangeset for help on using the changeset viewer.