Changeset 5412 for source/ariba


Ignore:
Timestamp:
Jul 29, 2009, 11:45:17 AM (15 years ago)
Author:
Christoph Mayer
Message:

-logging fix, -sdp fix, -endpoint operator fix, -endpoint aufräumen

Location:
source/ariba
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/Node.cpp

    r5316 r5412  
    7575
    7676        // join against further nodes
    77         if( ep != NULL && *ep != EndpointDescriptor::UNSPECIFIED )
     77        if( ep != NULL && ep->isUnspecified() == false )
    7878                base_overlay->joinSpoVNet( spovnetId, *ep);
    7979}
  • source/ariba/communication/EndpointDescriptor.h

    r5406 r5412  
    111111        bool operator==(const EndpointDescriptor& rh) const {
    112112                if (rh.isUnspecified() && isUnspecified()) return true;
     113                if (rh.isUnspecified() ^  isUnspecified()) return false;
     114
     115                assert( (!rh.isUnspecified()) && (!isUnspecified()) );
    113116                return endpoints == rh.endpoints;
    114117        }
    115118
    116119        bool operator!=(const EndpointDescriptor& rh) const {
    117                 if (!rh.isUnspecified() && !isUnspecified()) return true;
    118                 return endpoints != rh.endpoints;
     120                return ( !operator==(rh) );
    119121        }
    120122
  • source/ariba/overlay/BaseOverlay.cpp

    r5406 r5412  
    6060namespace overlay {
    6161
    62 #define logging_force(x) std::cout << x << std::endl;
    63 #define logging_force1(x) std::cout << x << std::endl;
    64 
    6562LinkDescriptor* BaseOverlay::getDescriptor( const LinkID& link, bool communication ) {
    6663        BOOST_FOREACH( LinkDescriptor* lp, links )
     
    127124                // get descriptor of first hop
    128125                rld = getDescriptor(rlid);
    129                 logging_force1( rld );
     126                logging_force( rld );
    130127
    131128                // is first hop a relay path? yes-> try to find real link!
     
    136133                else relayNode = rld->remoteNode;
    137134        }
    138         logging_force1( "Potential relay node " << relayNode.toString() );
     135        logging_force( "Potential relay node " << relayNode.toString() );
    139136        // do not return myself or use the node as relay node
    140137        if (relayNode == nodeId)
    141138                return NodeID::UNSPECIFIED;
    142139        else {
    143                 logging_force1( "Returning relay node " << relayNode.toString() );
     140                logging_force( "Returning relay node " << relayNode.toString() );
    144141                return relayNode;
    145142        }
     
    310307                        " with nodeid " << nodeId.toString());
    311308
    312         if(bootstrapEp == EndpointDescriptor::UNSPECIFIED && state == BaseOverlayStateInvalid){
     309        if(bootstrapEp.isUnspecified() && state == BaseOverlayStateInvalid){
    313310
    314311                // bootstrap against ourselfs
  • source/ariba/overlay/OverlayBootstrap.cpp

    r5405 r5412  
    6565        manager.registerCallback( this );
    6666        manager.registerModule( BootstrapManager::BootstrapTypePeriodicBroadcast );
    67         //manager.registerModule( BootstrapManager::BootstrapTypeBluetoothSdp );
     67        manager.registerModule( BootstrapManager::BootstrapTypeBluetoothSdp );
    6868}
    6969
     
    7777        manager.unregisterCallback( this );
    7878        manager.unregisterModule( BootstrapManager::BootstrapTypePeriodicBroadcast );
    79         //manager.unregisterModule( BootstrapManager::BootstrapTypeBluetoothSdp );
     79        manager.unregisterModule( BootstrapManager::BootstrapTypeBluetoothSdp );
    8080}
    8181
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.cpp

    r5358 r5412  
    217217
    218218        if (sdp_session_ == NULL) {
    219                 logging_error( "something is wrong with your SDP server, nothing registered" );
     219                logging_error( "something is wrong with your SDP server, nothing registered: " << strerror(errno) );
    220220        } else {
    221221                int ret = sdp_record_register(sdp_session_, &record, 0);
    222222
    223223                if(ret < 0){
    224                         logging_error("failed registering sdp record");
     224                        logging_error("failed registering sdp record: " << strerror(errno));
    225225                }else{
    226226                        logging_debug("sdp record registered using session " << sdp_session_);
     
    269269        sock = hci_open_dev(dev_id);
    270270        if (dev_id < 0 || sock < 0) {
    271                 logging_error("opening socket for device " << dev_id << " failed. can not scan for peers");
     271                logging_error("opening socket for device "
     272                                << dev_id << " failed. can not scan for peers: " << strerror(errno));
    272273                return;
    273274        }
     
    280281        num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
    281282        if (num_rsp < 0)
    282                 logging_error("hci_inquiry failed with " << num_rsp);
     283                logging_error("hci_inquiry failed with " << num_rsp << ": " << strerror(errno));
    283284
    284285        for (i = 0; i < num_rsp; i++) {
     
    289290
    290291                logging_debug("found peer [" << saddress << "] [" << sname << "]");
    291 
    292                 // TODO: sdp_search can be very slow, fork it!
    293292                sdp_search( address, sname );
    294293        }
     
    297296        close(sock);
    298297
    299         int nextscan = (rand() % 40) + 5;
     298        int nextscan = (rand() % 30) + 5;
    300299        logging_debug("next sdp scan in " << nextscan << " seconds");
    301300
     
    328327
    329328        if (session == NULL) {
    330                 logging_error("failed to connect to SDP server at " << ba2string(&target) <<".");
     329                logging_error("failed to connect to SDP server at "
     330                                << ba2string(&target) << ": " << strerror(errno));
    331331                return;
    332332        }
     
    373373                }
    374374        } else {
    375                 logging_error("sdp_service_search_attr_req failed with timeout");
     375                logging_error("sdp_service_search_attr_req failed with timeout: " << strerror(errno));
    376376        }
    377377
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h

    r5358 r5412  
    4545#include <string>
    4646#include <ctime>
     47#include <cerrno>
    4748#include <boost/bind.hpp>
    4849#include <boost/asio.hpp>
  • source/ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.cpp

    r5316 r5412  
    5858
    5959use_logging_cpp(PeriodicBroadcast);
    60 const long PeriodicBroadcast::timerinterval = 1000;
    61 const long PeriodicBroadcast::servicetimeout = 3000;
     60const long PeriodicBroadcast::timerinterval = 2000;
     61const long PeriodicBroadcast::servicetimeout = 5000;
    6262const unsigned int PeriodicBroadcast::serverport_v4 = 5634;
    6363const unsigned int PeriodicBroadcast::serverport_v6 = 5636;
  • source/ariba/utility/logging/Logging.h

    r5151 r5412  
    7676  #define logging_warn(x)   {colorWarn;  LOG4CXX_WARN(logger,x);  colorDefault;           }
    7777  #define logging_error(x)  {colorError; LOG4CXX_ERROR(logger,x); colorDefault;           }
     78  #define logging_force(x)  {colorInfo;  LOG4CXX_INFO(logger,x);  colorDefault;           }
    7879  #define logging_fatal(x)  {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); }
    7980
     
    8586  #define logging_warn(x)   {colorWarn;  LOG4CXX_WARN(logger,x);  colorDefault;           }
    8687  #define logging_error(x)  {colorError; LOG4CXX_ERROR(logger,x); colorDefault;           }
     88  #define logging_force(x)  {colorInfo;  LOG4CXX_INFO(logger,x);  colorDefault;           }
    8789  #define logging_fatal(x)  {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); }
    8890
  • source/ariba/utility/measurement/PathloadMeasurement.cpp

    r3690 r5412  
    108108        // get the endpoint for this node
    109109        const EndpointDescriptor& endp = baseoverlay->getEndpointDescriptor( resultNode );
    110         if( endp == EndpointDescriptor::UNSPECIFIED ){
     110        if( endp.isUnspecified() ){
    111111                logging_warn( "can not measure node " << resultNode.toString() << ": can't resolve endpoint" );
    112112                return;
  • source/ariba/utility/system/StartupWrapper.cpp

    r5405 r5412  
    9898        {
    9999                log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
    100                 logger->setLevel(log4cxx::Level::getWarn());
     100                logger->setLevel(log4cxx::Level::getDebug());
    101101        }
    102102
     
    123123                        logger->setLevel(log4cxx::Level::getDebug());
    124124        }
    125 */
     125         */
    126126
    127127        //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Note: See TracChangeset for help on using the changeset viewer.