- Timestamp:
- Dec 4, 2009, 10:25:17 AM (15 years ago)
- Location:
- source/ariba
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/overlay/BaseOverlay.cpp
r6967 r7018 987 987 // send over relayed link 988 988 msg.setRelayed(true); 989 //msg.setRelayed(false); 990 //msg.setRegisterRelay(true); 989 msg.setRegisterRelay(true); 991 990 992 991 // debug message … … 2112 2111 void BaseOverlay::stabilizeDHT() { 2113 2112 2114 // do not refresh every second2115 /*if (republishCounter < 2) {2113 // do refresh every 2 seconds 2114 if (republishCounter < 2) { 2116 2115 republishCounter++; 2117 2116 return; 2118 2117 } 2119 2118 republishCounter = 0; 2120 */ 2119 2121 2120 // remove old values from DHT 2122 2121 BOOST_FOREACH( DHTEntry& entry, dht->entries ) { … … 2125 2124 } 2126 2125 2127 // erase old values from local DHT 2128 BOOST_FOREACH( DHTEntry& entry, localDHT->entries ) { 2129 // erase old entries 2130 entry.erase_expired_entries(); 2131 } 2132 2133 // re-publish values 2126 // re-publish values-> do not refresh locally stored values 2134 2127 BOOST_FOREACH( DHTEntry& entry, localDHT->entries ) { 2135 2128 BOOST_FOREACH( ValueEntry& value, entry.values ) 2136 dhtPut(entry.key, value.get_value(), 0, false, true );2129 dhtPut(entry.key, value.get_value(), value.get_ttl(), false, true ); 2137 2130 } 2138 2131 } … … 2141 2134 bool BaseOverlay::handleDHTMessage( OverlayMsg* msg ) { 2142 2135 2143 // de capsulate message2144 logging_debug(" received DHT message");2136 // de-capsulate message 2137 logging_debug("Received DHT message"); 2145 2138 DHTMessage* dhtMsg = msg->decapsulate<DHTMessage>(); 2146 2139 … … 2159 2152 if (!overlayInterface->isClosestNodeTo(msg->getDestinationNode())) { 2160 2153 logging_debug("Routing DHT message to closest node " 2161 2162 2154 << " from " << msg->getSourceNode() 2155 << " to " << msg->getDestinationNode() 2163 2156 ); 2164 2157 route( msg ); … … 2169 2162 // now, we are the closest node... 2170 2163 switch (msg->getType()) { 2164 2165 // ----------------------------------------------------------------- put --- 2171 2166 case OverlayMsg::typeDHTPut: { 2172 logging_debug("DHT : Attempt to store values for key "2167 logging_debug("DHT-Put: Attempt to store values for key " 2173 2168 << dhtMsg->getKey()); 2174 2169 if (dhtMsg->doReplace()) { 2175 logging_debug("DHT : Attempt to replace key: remove old values first!");2170 logging_debug("DHT-Put: Attempt to replace key: remove old values first!"); 2176 2171 dht->remove(dhtMsg->getKey()); 2177 2172 } 2178 2173 BOOST_FOREACH( Data value, dhtMsg->getValues() ) { 2179 logging_debug("DHT : Stored value: " << value );2174 logging_debug("DHT-Put: Stored value: " << value ); 2180 2175 dht->put(dhtMsg->getKey(), value, dhtMsg->getTTL() ); 2181 2176 } … … 2183 2178 } 2184 2179 2180 // ----------------------------------------------------------------- get --- 2185 2181 case OverlayMsg::typeDHTGet: { 2186 2182 logging_info("DHT-Get: key=" << dhtMsg->getKey() ); … … 2197 2193 } 2198 2194 2195 // -------------------------------------------------------------- remove --- 2199 2196 case OverlayMsg::typeDHTRemove: { 2200 2197 if (dhtMsg->hasValues()) { … … 2206 2203 } 2207 2204 2205 // -------------------------------------------------------------- default--- 2208 2206 default: 2209 2207 logging_error("DHT Message type unknown."); … … 2217 2215 void BaseOverlay::dhtPut( const Data& key, const Data& value, int ttl, bool replace, bool no_local_refresh ) { 2218 2216 2219 logging_info("DHT: putting key=" << key << " value=" << value 2217 // log 2218 logging_info("DHT-Put:" 2219 << " key=" << key << " value=" << value 2220 2220 << " ttl=" << ttl << " replace=" << replace 2221 2221 ); 2222 2222 2223 2224 2223 if (!no_local_refresh) { 2224 2225 2225 // put into local data store (for refreshes) 2226 2226 if (replace) localDHT->remove(key); … … 2256 2256 /// removes all data stored at the given key 2257 2257 void BaseOverlay::dhtRemove( const Data& key ) { 2258 // log: remove key 2259 logging_info("DHT-Remove: Removing key=" << key ); 2260 2258 2261 // calculate hash 2259 2262 NodeID dest = NodeID::sha1(key.getBuffer(), key.getLength() / 8); … … 2268 2271 /// requests data stored using key 2269 2272 void BaseOverlay::dhtGet( const Data& key, const ServiceID& service ) { 2270 logging_info("DHT: trying to resolve key=" << 2273 // log: remove get 2274 logging_info("DHT-Get: Trying to resolve key=" << 2271 2275 key << " for service=" << service.toString() ); 2272 2276 … … 2283 2287 2284 2288 void BaseOverlay::dhtSend( OverlayMsg* msg, const NodeID& dest ) { 2285 logging_info("DHT: sending message with key=" << dest.toString() ); 2289 // log: dht send 2290 logging_info("DHT-Send: Sending message with key=" << dest.toString() ); 2291 2292 /// set source and destination 2286 2293 msg->setSourceNode(this->nodeId); 2287 2294 msg->setDestinationNode(dest); … … 2298 2305 2299 2306 // send message "normally" 2300 send( msg, dest);2307 send( msg, dest ); 2301 2308 } 2302 2309 -
source/ariba/utility/transport/tcpip/protlib/address.h
r6928 r7018 690 690 virtual udsaddress* copy() const; 691 691 virtual bool operator==(const address& ie) const; 692 692 dsdsd 693 693 /// constructor 694 694 udsaddress() : address(UDSAddress) { uds_socket = ""; socknum=0;};
Note:
See TracChangeset
for help on using the changeset viewer.