[network-manager-openconnect] 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] Fix: Hitting cancel after failure causes the next attempt to abort immediately
- Date: Tue, 22 May 2012 09:19:04 +0000 (UTC)
commit 12e173e93b1fc2559c24d870bcf1d0aba41e3d32
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.
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 fd14459..8a59e25 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1072,7 +1072,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) {
@@ -1142,6 +1142,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;
@@ -1153,7 +1154,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]