The connection status of the tunnel shall be consistent with the moment where liblinphone processes the event raised by the TunnelClient thread. With the previous logic, it could say that tunnel is connected as soon as the TunnelClient thread has connected, but not liblinphone has not yet taken the actions so that RTP packets from future calls go through the tunnel. This creates race conditions in applications where a call isn't going through the tunnel.