[tor-bugs] #5519 [Vidalia]: Some improvements for torcontrol code (ControlConnection, ControlSocket classes)

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Fri May 25 20:44:23 UTC 2012


#5519: Some improvements for torcontrol code (ControlConnection, ControlSocket
classes)
---------------------+------------------------------------------------------
 Reporter:  sebb     |          Owner:  sebb                
     Type:  task     |         Status:  needs_revision      
 Priority:  minor    |      Milestone:                      
Component:  Vidalia  |        Version:  Vidalia: 0.3.1-alpha
 Keywords:           |         Parent:                      
   Points:           |   Actualpoints:                      
---------------------+------------------------------------------------------

Comment(by chiiph):

 Actually the problem seems to be that sometimes, tor responds to
 PROTOCOLINFO before Vidalia adds a ReceiveWaiter to _recvQueue, I've added
 a warning msg to this method:

 {{{
 bool
 ControlConnection::send(const ControlCommand &cmd,
                         ControlReply &reply, QString *errmsg)
 {
   bool result = false;
   QString errstr;

   if (send(cmd, &errstr)) {
     /* Create and enqueue a new receive waiter */
     ReceiveWaiter *w = new ReceiveWaiter();
     _recvQueue.enqueue(w);

     /* Wait for and get the result, clean up, and return */
     qWarning() << "WAITING1";;

     result = w->getResult(&reply, &errstr);

 }}}

 And I see this in the log:

 {{{

 May 25 17:31:59.014 [debug] QtDebugMsg: torcontrol: Control Command:
 PROTOCOLINFO 1
 May 25 17:31:59.015 [debug] QtDebugMsg: torcontrol: Control Reply: 250
 PROTOCOLINFO 1
 250 AUTH METHODS=HASHEDPASSWORD
 250 VERSION Tor="0.2.3.12-alpha"
 250 OK
 May 25 17:31:59.036 [notice] QtWarningMsg: WAITING1

 }}}

 So Vidalia stays waiting for the result forever. One solution would be to
 do this:

 {{{

 bool
 ControlConnection::send(const ControlCommand &cmd,
                         ControlReply &reply, QString *errmsg)
 {
   bool result = false;
   QString errstr;

   /* Create and enqueue a new receive waiter */
   ReceiveWaiter *w = new ReceiveWaiter();
   _recvQueue.enqueue(w);

   if (send(cmd, &errstr)) {
     /* Wait for and get the result, clean up, and return */
     qWarning() << "WAITING1";;

     result = w->getResult(&reply, &errstr);
     qWarning() << "WAITING2";

     if (!result)
       tc::error("Failed to receive control reply: %1").arg(errstr);
     delete w;
   } else {
     tc::error("Failed to send control command (%1):
 %2").arg(cmd.keyword())
                                                         .arg(errstr);
     _recvQueue.dequeue();
   }

   if (!result && errmsg)
     *errmsg = errstr;
   return result;
 }

 }}}

 But I'm wondering if this is not another issue with this particular case
 of error.

 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5519#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list