Handle Reception of RENDEZVOUS_ESTABLISHED and RENDEZVOUS2 cells immediately
Two client-side events during hidden-service establishment are not handled event-based, but observed by the one second loop in main.c. This leads to unnecessary delays of hidden-service establishment up to two seconds together.
While other events like finishing to establish the introduction circuit in rend_client_introcirc_has_opened() call the function connection_ap_attach_pending() to proceed immediately, for two events this does not happen. Therefore the protocol proceeds after the one second loop has checked, if anything has changed. Depending on when the event occurs this check can happen anytime between zero and one second after the event.
One of the two events is the reception of a RENDEZVOUS2 cell in rend_client_receive_rendezvous().
The other situation containing the bug only occurs if the introduction circuit is established before the RENDEZVOUS_ESTABLISHED cell is received. If establishing the introduction circuit takes longer than sending the ESTABLISH_RENDEZVOUS cell and receiving the acknowledgment, everything is fine, because as mentioned before the rend_client_introcirc_has_opened() function initiates further steps. The buggy sequence of those events occurred in 28 per cent of 1,200 hidden service access attempts.
To fix this bug the connection_ap_attach_pending() function needs to be called after receiving RENDEZVOU2 and RENDEZVOUS_ESTABLISHED cells, too.
The bug was introduced in revision 817, when the connection_ap_attach_pending() function was called in the main loop for the first time.
[Automatically added by flyspray2trac: Operating System: All]