[network-manager-openconnect/NM_0_8] Fix: Hitting cancel after failure causes the next attempt to abort immediately
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openconnect/NM_0_8] Fix: Hitting cancel after failure causes the next attempt to abort immediately
- Date: Wed, 20 Jun 2012 15:37:40 +0000 (UTC)
commit 526cdf5c8224e411eb9a79b24690c5ef40d01fad
Author: David Woodhouse <David Woodhouse intel com>
Date: Tue May 22 10:12:48 2012 +0100
Fix: Hitting cancel after failure causes the next attempt to abort immediately
If you cancel one connection while it's connecting, you get the 'Socket
connecton cancelled' error displayed as it gives up. Or a normal failure
should also suffice. The 'cancel' button is active at this point.
$DEITY knows why. It shouldn't be, because there's nothing to cancel.
If you hit it, a byte is written to the cancel_pipe. Then if you attempt
to connect to a new host, your connection attempt aborts immediately because
the cancel pipe is readable.
First, ensure the cancel button is marked as not sensitive after handling
an error return in cookie_obtained(). And also make sure we clear all bytes
from the cancel pipes before starting a connection, just in case.
Reported by Mike Miller.
(cherry picked from commit 12e173e93b1fc2559c24d870bcf1d0aba41e3d32)
auth-dialog/main.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 5febfb8..5951682 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1153,7 +1153,7 @@ static gboolean cookie_obtained(auth_ui_data *ui_data)
GTK_STOCK_DIALOG_ERROR,
GTK_ICON_SIZE_DIALOG);
gtk_widget_show_all(ui_data->ssl_box);
- gtk_widget_set_sensitive(ui_data->cancel_button, TRUE);
+ gtk_widget_set_sensitive(ui_data->cancel_button, FALSE);
}
ui_data->retval = 1;
} else if (!ui_data->cookie_retval) {
@@ -1225,6 +1225,7 @@ static void connect_host(auth_ui_data *ui_data)
vpnhost *host;
int i;
int host_nr;
+ char cancelbuf;
ui_data->cancelled = FALSE;
ui_data->getting_cookie = TRUE;
@@ -1236,7 +1237,8 @@ static void connect_host(auth_ui_data *ui_data)
ssl_box_clear(ui_data);
gtk_widget_show(ui_data->getting_form_label);
gtk_widget_set_sensitive (ui_data->cancel_button, TRUE);
-
+ while (read(ui_data->cancel_pipes[0], &cancelbuf, 1) == 1)
+ ;
/* reset ssl context.
* TODO: this is probably not the way to go... */
openconnect_reset_ssl(ui_data->vpninfo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]