Show
Ignore:
Timestamp:
01/13/06 23:32:35 (3 years ago)
Author:
edmanm
Message:

Use QAbstractSocket's isValid() method to determine if the control socket is
connected;
Check if the socket is ready for reading and writing before sending or
receiving;
Update the control test code for the method names I changed back in revision
75;
The authenticate() method in TorControl? will handle loading controller
authentication tokens itself, once it's implemented. (maybe)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/control/torcontrol.cpp

    r83 r84  
    122122TorControl::isConnected() 
    123123{ 
    124   return (_controlConn.state() == QAbstractSocket::ConnectedState); 
     124  return _controlConn.isValid(); 
    125125} 
    126126 
     
    131131 */ 
    132132bool 
    133 TorControl::authenticate(QByteArray token, QString *errmsg) 
    134 { 
    135   ControlCommand cmd("AUTHENTICATE", QString(token)); 
     133TorControl::authenticate(QString *errmsg) 
     134{ 
     135  VidaliaSettings settings; 
     136  ControlCommand cmd("AUTHENTICATE", QString(settings.getAuthToken())); 
    136137  ControlReply reply; 
    137138 
     
    182183      } 
    183184    } 
     185  } else { 
     186    /* Sending the control command failed */ 
     187    return false; 
    184188  } 
    185189  return true; 
     
    195199  if (getInfo(map, errmsg)) { 
    196200    val = map.value(key); 
     201    return true; 
    197202  } 
    198203  return false;