Changeset 5838
- Timestamp:
- Aug 11, 2009, 8:39:47 AM (15 years ago)
- Location:
- source/ariba
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/SideportListener.cpp
r5786 r5838 86 86 if( overlay == NULL ) return false; 87 87 88 bool relay = false; 89 88 90 BOOST_FOREACH( LinkDescriptor* link, overlay->links ){ 91 92 // is we find a direct connection this is not a relayed node 93 if(link->relay == false && link->remoteNode == node && link->up) 94 return false; 95 96 // if we find a relay conenction this can be a relayed node 97 // but only if we find no direct connection as above 89 98 if( link->relay && link->remoteNode == node && link->up) 90 re turntrue;99 relay = true; 91 100 } 92 101 93 return false;102 return relay; 94 103 } 95 104 -
source/ariba/overlay/BaseOverlay.cpp
r5803 r5838 370 370 } 371 371 372 373 372 //ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." ); 374 373 logging_info( "Starting to join spovnet " << id.toString() << … … 399 398 const LinkID& lnk = bc->establishLink( bootstrapEp ); 400 399 bootstrapLinks.push_back(lnk); 400 401 401 logging_info("join process initiated for " << id.toString() << "..."); 402 402 403 } 403 404 } … … 1107 1108 state = BaseOverlayStateCompleted; 1108 1109 overlayInterface->createOverlay(); 1109 1110 1110 overlayInterface->joinOverlay( replyMsg->getBootstrapEndpoint() ); 1111 1112 //record bootstrap ep as good endpoint to join 1113 overlayBootstrap.recordJoin( replyMsg->getBootstrapEndpoint() ); 1111 1114 1112 1115 // update ovlvis … … 1555 1558 1556 1559 vector<NodeID> BaseOverlay::getOverlayNeighbors(bool deep) const { 1560 1561 vector<NodeID> nodes = overlayInterface->getKnownNodes(deep); 1562 1557 1563 // the known nodes _can_ also include our node, so we remove ourself 1558 vector<NodeID> nodes = overlayInterface->getKnownNodes(deep);1559 1560 1564 vector<NodeID>::iterator i = find( nodes.begin(), nodes.end(), this->nodeId ); 1561 1565 if( i != nodes.end() ) nodes.erase( i ); -
source/ariba/overlay/OverlayBootstrap.cpp
r5412 r5838 50 50 spovnetid( SpoVNetID::UNSPECIFIED ), 51 51 nodeid( NodeID::UNSPECIFIED ), 52 overlay( NULL ){ 52 overlay( NULL ), 53 watchtimer(this) { 54 55 srand(time(NULL)); 53 56 } 54 57 … … 66 69 manager.registerModule( BootstrapManager::BootstrapTypePeriodicBroadcast ); 67 70 manager.registerModule( BootstrapManager::BootstrapTypeBluetoothSdp ); 71 72 watchtimer.startWatchdog(); 68 73 } 69 74 … … 78 83 manager.unregisterModule( BootstrapManager::BootstrapTypePeriodicBroadcast ); 79 84 manager.unregisterModule( BootstrapManager::BootstrapTypeBluetoothSdp ); 85 86 watchtimer.stopWatchdog(); 80 87 } 81 88 … … 144 151 } 145 152 153 void OverlayBootstrap::recordJoin(const EndpointDescriptor& _ep){ 154 boost::mutex::scoped_lock lock(lastJoinesMutex); 155 156 EventData data; 157 data.spovnetid = spovnetid; 158 data.nodeid = nodeid; 159 data.endpoint = _ep; 160 161 lastJoines.push_front(JoinData(data)); 162 } 163 164 void OverlayBootstrap::checkOverlayStatus(){ 165 166 // if we have no overlay neighbors, try to bootstrap using 167 // bootstrap information that we already used 168 169 { //limit history to 10 endpoints 170 boost::mutex::scoped_lock lock(lastJoinesMutex); 171 while(lastJoines.size() > 10) 172 lastJoines.pop_back(); 173 } 174 175 // we have overlay neighbors -> ok 176 if(overlay->getOverlayNeighbors().size() > 0) return; 177 178 // no overlay neighbors -> try out already 179 // successfully used bootstrap nodes 180 JoinData data; 181 { 182 boost::mutex::scoped_lock lock(lastJoinesMutex); 183 JoinStack::iterator i = lastJoines.begin(); 184 if(i == lastJoines.end()) return; 185 186 // use last used element and then put it into back 187 JoinData data = *i; 188 lastJoines.pop_front(); 189 lastJoines.push_back(data); 190 } 191 192 logging_info("no overlay connections detected, " << 193 "trying to join using old bootstrap information"); 194 195 // try to join using this node, if the join is successfull 196 // the endpoint will again be inserted using recordJoin 197 overlay->joinSpoVNet( spovnetid, data.data.endpoint ); 198 } 199 200 OverlayBootstrap::WatchdogTimer::WatchdogTimer(OverlayBootstrap* _obj) : obj(_obj) { 201 } 202 203 void OverlayBootstrap::WatchdogTimer::startWatchdog(){ 204 Timer::setInterval(2000); 205 Timer::start(); 206 } 207 208 void OverlayBootstrap::WatchdogTimer::stopWatchdog(){ 209 Timer::stop(); 210 } 211 212 void OverlayBootstrap::WatchdogTimer::eventFunction(){ 213 if(obj == NULL) return; 214 obj->checkOverlayStatus(); 215 } 216 146 217 }} // namespace ariba, overlay -
source/ariba/overlay/OverlayBootstrap.h
r4866 r5838 42 42 #include <string> 43 43 #include <sstream> 44 #include <ctime> 45 #include <deque> 46 #include <boost/thread/mutex.hpp> 44 47 #include "ariba/utility/logging/Logging.h" 45 48 #include "ariba/utility/types.h" 49 #include "ariba/utility/system/Timer.h" 46 50 #include "ariba/utility/bootstrap/BootstrapManager.h" 47 51 #include "ariba/utility/bootstrap/BootstrapInformationCallback.h" … … 52 56 #include "ariba/utility/system/SystemEventType.h" 53 57 58 using std::deque; 54 59 using std::string; 55 60 using std::ostringstream; … … 62 67 using ariba::utility::SystemEvent; 63 68 using ariba::utility::SystemQueue; 69 using ariba::utility::Timer; 64 70 using ariba::utility::SystemEventListener; 65 71 … … 81 87 void revoke(); 82 88 89 void recordJoin(const EndpointDescriptor& _ep); 90 83 91 protected: 84 92 virtual void handleSystemEvent(const SystemEvent& event); … … 86 94 87 95 private: 88 typedef struct _EventData { 96 class EventData { 97 public: 89 98 SpoVNetID spovnetid; 90 99 NodeID nodeid; 91 100 EndpointDescriptor endpoint; 92 } EventData;101 }; 93 102 94 103 BootstrapManager& manager; … … 98 107 string randname; 99 108 109 class JoinData { 110 public: 111 time_t timestamp; 112 EventData data; 113 114 JoinData(const EventData& _data){ 115 timestamp = time(NULL); 116 data = _data; 117 } 118 119 JoinData(){ 120 timestamp = time(NULL); 121 } 122 }; 123 124 class WatchdogTimer : public Timer { 125 public: 126 WatchdogTimer(OverlayBootstrap* _obj); 127 void startWatchdog(); 128 void stopWatchdog(); 129 protected: 130 virtual void eventFunction(); 131 private: 132 OverlayBootstrap* obj; 133 }; 134 135 typedef deque<JoinData> JoinStack; 136 JoinStack lastJoines; 137 boost::mutex lastJoinesMutex; 138 WatchdogTimer watchtimer; 139 void checkOverlayStatus(); 100 140 }; 101 141 -
source/ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.cpp
r5532 r5838 58 58 59 59 use_logging_cpp(PeriodicBroadcast); 60 const long PeriodicBroadcast::timerinterval = 2;61 const long PeriodicBroadcast::servicetimeout = 5;60 const long PeriodicBroadcast::timerinterval = 1; 61 const long PeriodicBroadcast::servicetimeout = 3; 62 62 const unsigned int PeriodicBroadcast::serverport_v4 = 5634; 63 63 const unsigned int PeriodicBroadcast::serverport_v6 = 5636;
Note:
See TracChangeset
for help on using the changeset viewer.