Changeset 5967


Ignore:
Timestamp:
Aug 14, 2009, 6:44:45 PM (15 years ago)
Author:
Christoph Mayer
Message:

rfcomm sdp fixing

Location:
source/ariba
Files:
5 edited

Legend:

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

    r5953 r5967  
    3838
    3939#include "OverlayBootstrap.h"
     40
    4041#include "BaseOverlay.h"
     42#include "ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h"
     43
     44using ariba::utility::BluetoothSdp;
    4145
    4246namespace ariba {
     
    5155                nodeid( NodeID::UNSPECIFIED ),
    5256                overlay( NULL ),
    53                 watchtimer(this) {
     57                watchtimer(this),
     58                haveOverlayConnection(false){
    5459
    5560        srand(time(NULL));
     61
     62        BluetoothSdp::CONNECTION_CHECKER = this;
    5663}
    5764
     
    162169
    163170        lastJoines.push_front(data);
     171}
     172
     173bool OverlayBootstrap::haveOverlayConnections(){
     174        boost::mutex::scoped_lock lock(haveOverlayConnectionMutex);
     175        return haveOverlayConnection;
    164176}
    165177
     
    175187        }
    176188
    177         // TODO: --> SIGCOMM hack <--
    178         // if we have no overlay neighbors, make sure sdp is loaded
    179         // sdp searching is turned off when we have bootstrapped
    180         if(overlay->getOverlayNeighbors().size() > 0){
    181 
    182                 // switch off sdp when we we _are_ in the spovnet already
    183                 if(manager.isModuleRegistered(BootstrapManager::BootstrapTypeBluetoothSdp))
    184                         manager.unregisterModule(BootstrapManager::BootstrapTypeBluetoothSdp);
    185 
    186                 return;
     189        {
     190                boost::mutex::scoped_lock lock(haveOverlayConnectionMutex);
     191                haveOverlayConnection = overlay->getOverlayNeighbors().size() > 0;
     192
     193                // we have overlay neighbors -> ok nothing to do
     194                if(haveOverlayConnection > 0) return;
    187195        }
    188196
    189         // make sure sdp is running when we are _not_ in the spovnet
    190         if(!manager.isModuleRegistered(BootstrapManager::BootstrapTypeBluetoothSdp))
    191                 manager.registerModule(BootstrapManager::BootstrapTypeBluetoothSdp);
    192 
    193         //
    194         // we have overlay neighbors -> ok
    195         //
    196 
     197        // no overlay neighbors, see if we can join using old information
    197198        logging_info("overlay not joined, checking for earlier used bootstrap information");
    198199        EndpointDescriptor joinep = EndpointDescriptor::UNSPECIFIED();
  • source/ariba/overlay/OverlayBootstrap.h

    r5860 r5967  
    9090
    9191        void recordJoin(const EndpointDescriptor& _ep);
     92        bool haveOverlayConnections();
    9293
    9394protected:
     
    134135        WatchdogTimer watchtimer;
    135136        void checkOverlayStatus();
     137
     138
     139        bool haveOverlayConnection;
     140        boost::mutex haveOverlayConnectionMutex;
    136141};
    137142
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.cpp

    r5953 r5967  
    3838
    3939#include "BluetoothSdp.h"
     40#include "ariba/overlay/OverlayBootstrap.h"
    4041
    4142#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
     
    6263namespace ariba {
    6364namespace utility {
     65
    6466use_logging_cpp(BluetoothSdp);
     67OverlayBootstrap* BluetoothSdp::CONNECTION_CHECKER = NULL;
    6568
    6669BluetoothSdp::BluetoothSdp(BootstrapInformationCallback* _callback) :
     
    258261        //
    259262
    260         //if(!haveConnections()){
     263        if(!haveConnections()){
    261264
    262265                /*
     
    304307                close(sock);
    305308
    306         //} else {
    307                 //logging_debug("have active rfcomm connections, not searching");
    308         //}
    309 
    310         int nextscan = (rand() % 5) + 3;
     309        } else {
     310                logging_debug("have active connections, no sdp searching");
     311        }
     312
     313        int nextscan = (rand() % 10) + 5;
    311314        logging_debug("next sdp scan try in " << nextscan << " seconds");
    312315
     
    419422bool BluetoothSdp::haveConnections(){
    420423
     424        // TODO: currently we check for overlay connectivity
     425
     426        if(CONNECTION_CHECKER == NULL) return false;
     427        return CONNECTION_CHECKER->haveOverlayConnections();
     428
     429
     430        /* TODO: this will check for rfcomm connections
    421431        struct hci_conn_list_req* cl = NULL;
    422432        struct hci_conn_info* ci = NULL;
     
    445455
    446456        return haveconn;
     457        */
    447458}
    448459
  • source/ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h

    r5638 r5967  
    6565
    6666namespace ariba {
     67  namespace overlay {
     68    class OverlayBootstrap;
     69  }
     70}
     71
     72using ariba::overlay::OverlayBootstrap;
     73
     74namespace ariba {
    6775namespace utility {
    6876
     
    7078        use_logging_h(BluetoothSdp);
    7179public:
     80        static OverlayBootstrap* CONNECTION_CHECKER;
     81
    7282        BluetoothSdp(BootstrapInformationCallback* _callback);
    7383        virtual ~BluetoothSdp();
  • source/ariba/utility/system/StartupWrapper.cpp

    r5926 r5967  
    104104        // set up again an individual level if you like
    105105       
    106         {
     106        /*{
    107107                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("MCPO"));
    108108                logger->setLevel(log4cxx::Level::getDebug());
    109109        }
     110        {
     111                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BaseCommunication"));
     112                logger->setLevel(log4cxx::Level::getDebug());
     113        }*/
     114        {
     115                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("OverlayBootstrap"));
     116                logger->setLevel(log4cxx::Level::getDebug());
     117        }
     118        {
     119                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BootstrapManager"));
     120                logger->setLevel(log4cxx::Level::getDebug());
     121        }
     122        {
     123                log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BluetoothSdp"));
     124                logger->setLevel(log4cxx::Level::getDebug());
     125        }
    110126        /*{
    111                 log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BaseCommunication"));
    112                 logger->setLevel(log4cxx::Level::getDebug());
    113         }
    114         {
    115                 log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("OverlayBootstrap"));
    116                 logger->setLevel(log4cxx::Level::getDebug());
    117         }
    118         {
    119                         log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BootstrapManager"));
    120                         logger->setLevel(log4cxx::Level::getDebug());
    121         }
    122         {
    123127                        log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("Chord"));
    124128                        logger->setLevel(log4cxx::Level::getInfo());
Note: See TracChangeset for help on using the changeset viewer.