Changeset 5627


Ignore:
Timestamp:
Aug 3, 2009, 4:33:50 PM (15 years ago)
Author:
stud-florian
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/transport/rfcomm/rfcomm.cpp

    r5614 r5627  
    3333public:
    3434        link_info(io_service& io ) :
    35                 io(io), up(false), local(), remote(), socket(new bluetooth::rfcomm::socket(io)), connect_retries(0),
     35                io(io), up(false), connecting(false), local(), remote(), socket(new bluetooth::rfcomm::socket(io)), connect_retries(0),
    3636                size(0), buffer(NULL), sending(false) {
    3737        }
     
    5151        // state
    5252        bool up;
     53        bool connecting;
    5354        rfcomm_endpoint local, remote;
    5455        bluetooth::rfcomm::socket* socket;
     
    136137
    137138        // not found, or not up? ->try to (re-)connect
    138         if (info==NULL || !info->up || !info->socket->is_open() ) {
     139        if (info==NULL || ((!info->up || !info->socket->is_open()) && !info->connecting) ) {
    139140                logging_debug( "Connecting to " << endpoint.to_string() );
    140141                if (info != NULL && (!info->up || !info->socket->is_open())) {
     
    146147                info->connect_retries = 0;
    147148                info->remote = endpoint;
     149                info->connecting = true;
    148150                info->socket->async_connect( convert(endpoint), boost::bind(
    149151                        &rfcomm::handle_connect, this,
    150152                        boost::asio::placeholders::error, info
    151153                ));
     154                links.push_back(info);
    152155        }
    153156
     
    260263                if (info->connect_retries<3) {
    261264                        // increase counter
     265                        info->connecting = false;
    262266                        info->connect_retries++;
    263267                        info->reinit();
     
    276280        // convert endpoints
    277281        info->up = true;
     282        info->connecting = false;
    278283        info->local  = convert( info->socket->local_endpoint()  );
    279284        info->remote = convert( info->socket->remote_endpoint() );
Note: See TracChangeset for help on using the changeset viewer.