Changeset 7018 for source


Ignore:
Timestamp:
Dec 4, 2009, 10:25:17 AM (14 years ago)
Author:
mies
Message:
 
Location:
source/ariba
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/overlay/BaseOverlay.cpp

    r6967 r7018  
    987987        // send over relayed link
    988988        msg.setRelayed(true);
    989         //msg.setRelayed(false);
    990         //msg.setRegisterRelay(true);
     989        msg.setRegisterRelay(true);
    991990
    992991        // debug message
     
    21122111void BaseOverlay::stabilizeDHT() {
    21132112
    2114         // do not refresh every second
    2115 /*      if (republishCounter < 2) {
     2113        // do refresh every 2 seconds
     2114        if (republishCounter < 2) {
    21162115                republishCounter++;
    21172116                return;
    21182117        }
    21192118        republishCounter = 0;
    2120 */
     2119
    21212120        // remove old values from DHT
    21222121        BOOST_FOREACH( DHTEntry& entry, dht->entries ) {
     
    21252124        }
    21262125
    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
    21342127        BOOST_FOREACH( DHTEntry& entry, localDHT->entries ) {
    21352128                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 );
    21372130        }
    21382131}
     
    21412134bool BaseOverlay::handleDHTMessage( OverlayMsg* msg ) {
    21422135
    2143         // decapsulate message
    2144         logging_debug("received DHT message");
     2136        // de-capsulate message
     2137        logging_debug("Received DHT message");
    21452138        DHTMessage* dhtMsg = msg->decapsulate<DHTMessage>();
    21462139
     
    21592152        if (!overlayInterface->isClosestNodeTo(msg->getDestinationNode())) {
    21602153                logging_debug("Routing DHT message to closest node "
    2161                                 << " from " << msg->getSourceNode()
    2162                                 << " to " << msg->getDestinationNode()
     2154                        << " from " << msg->getSourceNode()
     2155                        << " to " << msg->getDestinationNode()
    21632156                );
    21642157                route( msg );
     
    21692162        // now, we are the closest node...
    21702163        switch (msg->getType()) {
     2164
     2165        // ----------------------------------------------------------------- put ---
    21712166        case OverlayMsg::typeDHTPut: {
    2172                 logging_debug("DHT: Attempt to store values for key "
     2167                logging_debug("DHT-Put: Attempt to store values for key "
    21732168                                << dhtMsg->getKey());
    21742169                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!");
    21762171                        dht->remove(dhtMsg->getKey());
    21772172                }
    21782173                BOOST_FOREACH( Data value, dhtMsg->getValues() ) {
    2179                         logging_debug("DHT: Stored value: " << value );
     2174                        logging_debug("DHT-Put: Stored value: " << value );
    21802175                        dht->put(dhtMsg->getKey(), value, dhtMsg->getTTL() );
    21812176                }
     
    21832178        }
    21842179
     2180        // ----------------------------------------------------------------- get ---
    21852181        case OverlayMsg::typeDHTGet: {
    21862182                logging_info("DHT-Get: key=" << dhtMsg->getKey() );
     
    21972193        }
    21982194
     2195        // -------------------------------------------------------------- remove ---
    21992196        case OverlayMsg::typeDHTRemove: {
    22002197                if (dhtMsg->hasValues()) {
     
    22062203        }
    22072204
     2205        // -------------------------------------------------------------- default---
    22082206        default:
    22092207                logging_error("DHT Message type unknown.");
     
    22172215void BaseOverlay::dhtPut( const Data& key, const Data& value, int ttl, bool replace, bool no_local_refresh ) {
    22182216
    2219         logging_info("DHT: putting key=" << key << " value=" << value
     2217        // log
     2218        logging_info("DHT-Put:"
     2219                << " key=" << key << " value=" << value
    22202220                << " ttl=" << ttl << " replace=" << replace
    22212221        );
    22222222
    2223 
    22242223        if (!no_local_refresh) {
     2224
    22252225                // put into local data store (for refreshes)
    22262226                if (replace) localDHT->remove(key);
     
    22562256/// removes all data stored at the given key
    22572257void BaseOverlay::dhtRemove( const Data& key ) {
     2258        // log: remove key
     2259        logging_info("DHT-Remove: Removing key=" << key );
     2260
    22582261        // calculate hash
    22592262        NodeID dest = NodeID::sha1(key.getBuffer(), key.getLength() / 8);
     
    22682271/// requests data stored using key
    22692272void 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=" <<
    22712275                        key << " for service=" << service.toString() );
    22722276
     
    22832287
    22842288void 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
    22862293        msg->setSourceNode(this->nodeId);
    22872294        msg->setDestinationNode(dest);
     
    22982305
    22992306        // send message "normally"
    2300         send(msg, dest);
     2307        send( msg, dest );
    23012308}
    23022309
  • source/ariba/utility/transport/tcpip/protlib/address.h

    r6928 r7018  
    690690    virtual udsaddress* copy() const;
    691691    virtual bool operator==(const address& ie) const;
    692 
     692dsdsd
    693693    /// constructor
    694694    udsaddress() : address(UDSAddress) { uds_socket = ""; socknum=0;};
Note: See TracChangeset for help on using the changeset viewer.