Changeset 3071
- Timestamp:
- Apr 24, 2009, 4:34:53 PM (16 years ago)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/pingpong/PingPong.cpp
r3056 r3071 87 87 Timer::stop(); 88 88 89 // leave spovnet 90 node->leave(); 91 89 92 // unbind communication and node listener 90 93 node->unbind( this ); /*NodeListener*/ 91 94 node->unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/ 92 93 // leave spovnet94 node->leave();95 95 96 96 // stop the ariba module … … 111 111 // this can be all nodes (OneHop) overlay or just some neighbors 112 112 // in case of a Chord or Kademlia structure 113 114 // in this sample we use auto-links: we just send out our message 115 // to the node and the link is established automatically. for more 116 // control we would use the node->establishLink function to create 117 // a link and start using the link in the CommunicationListener::onLinkUp 118 // function that is implemented further down in PingPong::onLinkUp 113 119 114 120 logging_info( "pinging overlay neighbors with ping id " << ++pingId ); … … 139 145 140 146 void PingPong::onJoinFailed( const SpoVNetID& vid ) { 141 logging_error(" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXpingpong node join failed, spovnetid=" << vid.toString() );147 logging_error("pingpong node join failed, spovnetid=" << vid.toString() ); 142 148 } 143 149 … … 150 156 } 151 157 152 // communication listener153 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) {154 logging_debug( "node " << remote.toString() << " wants to build up a link with us ... allowing" );155 return true;156 }157 158 158 void PingPong::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk) { 159 160 159 PingPongMessage* pingmsg = msg.getMessage()->convert<PingPongMessage> (); 161 160 … … 176 175 177 176 void PingPong::onLinkChanged(const LinkID& lnk, const NodeID& remote){ 178 logging_info( " receivedlink-changed event for link " << lnk.toString()177 logging_info( "link-changed event for link " << lnk.toString() 179 178 << " and node " << remote.toString() ); 179 } 180 181 bool PingPong::onLinkRequest(const NodeID& remote, const DataMessage& msg) { 182 logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" ); 183 return true; 180 184 } 181 185 … … 185 189 } 186 190 187 void PingPong::onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop){188 logging_info( "received link-qos-changed event for link " << lnk.toString()189 << " and node " << remote.toString()190 << " with link properties " << prop.toString() );191 }192 193 191 }}} // namespace ariba, application, pingpong -
sample/pingpong/PingPong.h
r3056 r3071 35 35 protected: 36 36 // communication listener interface 37 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg );37 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED); 38 38 virtual void onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk= LinkID::UNSPECIFIED); 39 39 virtual void onLinkUp(const LinkID& lnk, const NodeID& remote); … … 41 41 virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote); 42 42 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote); 43 virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, const LinkProperties& prop);44 43 45 44 // node listener interface -
source/ariba/CommunicationListener.cpp
r3056 r3071 59 59 } 60 60 61 void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r,62 const LinkProperties& p) {63 }64 65 61 bool CommunicationListener::onLinkRequest(const NodeID& remote, 66 62 const DataMessage& msg) { … … 73 69 74 70 // --- extended message functionality --- 71 //void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r, 72 // const LinkProperties& p) { 73 //} 74 75 // --- extended message functionality --- 75 76 // void CommunicationListener::onMessageSent(seqnum_t seq_num, bool failed, 76 77 // const DataMessage& msg) { -
source/ariba/CommunicationListener.h
r3056 r3071 71 71 virtual void onLinkFail(const LinkID& lnk, const NodeID& remote); 72 72 73 virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, 74 const LinkProperties& prop); 75 76 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg); 73 virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg = DataMessage::UNSPECIFIED); 77 74 78 75 // --- general receive method --- … … 80 77 virtual void onMessage(const DataMessage& msg, const NodeID& remote, 81 78 const LinkID& lnk = LinkID::UNSPECIFIED); 79 80 // --- extended message functionality --- 81 // virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote, 82 // const LinkProperties& prop); 82 83 83 84 // --- extended message functionality --- -
source/ariba/Node.cpp
r3067 r3071 57 57 } 58 58 59 //TODO: Implement error handling: no bootstrap node available60 59 void Node::join(const Name& vnetname) { 61 60 spovnetId = vnetname.toSpoVNetId(); -
source/ariba/Node.h
r3067 r3071 58 58 #include "DataMessage.h" 59 59 60 using std::vector; 60 61 using ariba::overlay::BaseOverlay; 61 using std::vector;62 62 63 63 namespace ariba { -
source/ariba/overlay/BaseOverlay.cpp
r3067 r3071 98 98 99 99 ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." ); 100 logging_info( "starting to join spovnet " << id.toString() << "..."); 100 logging_info( "starting to join spovnet " << id.toString() << 101 " with nodeid " << nodeId.toString()); 101 102 102 103 // … … 145 146 logging_debug( "leaving overlay" ); 146 147 // first, leave the overlay interface 147 overlayInterface->leaveOverlay(); 148 if( overlayInterface != NULL ) 149 overlayInterface->leaveOverlay(); 148 150 149 151 // --> leave spovnet … … 177 179 // 178 180 179 logging_info( "creating spovnet " + id.toString());181 logging_info( "creating spovnet " + id.toString() << " with nodeid " << nodeId.toString() ); 180 182 181 183 spovnetId = id; … … 502 504 if( i == linkMapping.end() ) return; 503 505 504 if( i->second.interface != NULL ) 506 if( i->second.interface != NULL ){ 505 507 i->second.interface->onLinkChanged( id, i->second.node ); 508 // call onLinkQoSChanged? 509 } 506 510 507 511 i->second.markused(); … … 537 541 538 542 // TODO: convert QoSParameterSet to the LinkProperties properties 539 if( i->second.interface != NULL ) 540 i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT ); 543 if( i->second.interface != NULL ){ 544 // TODO: currently not in the interface: i->second.interface->onLinkQoSChanged( id, i->second.node, LinkProperties::DEFAULT ); 545 } 541 546 542 547 i->second.markused(); 548 } 549 550 bool BaseOverlay::onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ){ 551 552 // also see in the receiveMessage function. there the higher layer service 553 // is asked whether to accept link requests, but there a basic link association is 554 // already built up, so we know the node id 555 logging_debug("received link request from " << remote->toString() << ", accepting"); 556 return true; 543 557 } 544 558 … … 791 805 792 806 i->second.interface = iface; 793 iface->onLinkUp( link, sourcenode );794 807 i->second.markused(); 795 808 796 return true ; 809 // 810 // ask the service whether it wants to accept this link 811 // 812 813 if( iface->onLinkRequest(sourcenode) ){ 814 iface->onLinkUp( link, sourcenode ); 815 } else { 816 // prevent onLinkDown calls to the service 817 i->second.interface = NULL; 818 // drop the link 819 dropLink( link ); 820 } 821 822 return true; 797 823 798 824 } // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeUpdate) ) -
source/ariba/overlay/BaseOverlay.h
r3067 r3071 250 250 251 251 /** 252 * TODO252 * @see ariba::communication::CommunicationEvents.h 253 253 */ 254 254 virtual void onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 255 255 256 256 /** 257 * TODO257 * @see ariba::communication::CommunicationEvents.h 258 258 */ 259 259 virtual void onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 260 260 261 /** 262 * @see ariba::communication::CommunicationEvents.h 263 */ 261 264 virtual void onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote ); 262 265 263 266 /** 264 * TODO267 * @see ariba::communication::CommunicationEvents.h 265 268 */ 266 269 virtual void onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 267 270 268 271 /** 269 * TODO272 * @see ariba::communication::CommunicationEvents.h 270 273 */ 271 274 virtual void onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos ); 275 276 /** 277 * @see ariba::communication::CommunicationEvents.h 278 */ 279 virtual bool onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ); 272 280 273 281 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
source/ariba/utility/system/StartupWrapper.cpp
r3067 r3071 103 103 { 104 104 log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger()); 105 logger->setLevel(log4cxx::Level::get Info());105 logger->setLevel(log4cxx::Level::getDebug()); 106 106 } 107 107
Note:
See TracChangeset
for help on using the changeset viewer.