Commit 50d0aa50f71631c5cd566907ffeec4ee96e8a367
1 parent
3f62a285
Exists in
master
and in
5 other branches
Fixing hang on multiple connect/disconnect operations
Showing
1 changed file
with
34 additions
and
4 deletions
Show diff stats
src/pw3270/actions.c
| @@ -67,7 +67,10 @@ static void do_lib3270_action(GtkAction *action, GtkWidget *widget) | @@ -67,7 +67,10 @@ static void do_lib3270_action(GtkAction *action, GtkWidget *widget) | ||
| 67 | 67 | ||
| 68 | trace_action(action,widget); | 68 | trace_action(action,widget); |
| 69 | 69 | ||
| 70 | - call(v3270_get_session(widget)); | 70 | + if(call(v3270_get_session(widget))) |
| 71 | + { | ||
| 72 | + g_message("Action \"%s\" failed: %s",gtk_action_get_name(action),strerror(errno)); | ||
| 73 | + } | ||
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | static void connect_action(GtkAction *action, GtkWidget *widget) | 76 | static void connect_action(GtkAction *action, GtkWidget *widget) |
| @@ -77,7 +80,22 @@ static void connect_action(GtkAction *action, GtkWidget *widget) | @@ -77,7 +80,22 @@ static void connect_action(GtkAction *action, GtkWidget *widget) | ||
| 77 | const gchar * colortype = (const gchar *) g_object_get_data(G_OBJECT(action),"colors"); | 80 | const gchar * colortype = (const gchar *) g_object_get_data(G_OBJECT(action),"colors"); |
| 78 | // unsigned short colors; | 81 | // unsigned short colors; |
| 79 | 82 | ||
| 80 | - trace_action(action,widget); | 83 | +// trace_action(action,widget); |
| 84 | + | ||
| 85 | + lib3270_trace_event( | ||
| 86 | + v3270_get_session(widget), | ||
| 87 | + "Action %s activated on widget %p\nurl=%s\nsystype=%s\ncolortype=%s\n", | ||
| 88 | + gtk_action_get_name(action), | ||
| 89 | + widget, | ||
| 90 | + (host ? host : "-"), | ||
| 91 | + (systype ? systype : "-"), | ||
| 92 | + (colortype ? colortype : "-") | ||
| 93 | + ); | ||
| 94 | + | ||
| 95 | + /* | ||
| 96 | + lib3270_trace_event( | ||
| 97 | + v3270_get_session(widget),"Action %s activated on widget %p\n",gtk_action_get_name(a),w); | ||
| 98 | + */ | ||
| 81 | 99 | ||
| 82 | if(host) | 100 | if(host) |
| 83 | v3270_set_url(widget,host); | 101 | v3270_set_url(widget,host); |
| @@ -88,14 +106,26 @@ static void connect_action(GtkAction *action, GtkWidget *widget) | @@ -88,14 +106,26 @@ static void connect_action(GtkAction *action, GtkWidget *widget) | ||
| 88 | if(colortype) | 106 | if(colortype) |
| 89 | v3270_set_session_color_type(widget,atoi(colortype)); | 107 | v3270_set_session_color_type(widget,atoi(colortype)); |
| 90 | 108 | ||
| 91 | - host = v3270_get_hostname(widget); | 109 | + host = lib3270_get_url(v3270_get_session(widget)); |
| 110 | + | ||
| 111 | + trace("host=%s",host); | ||
| 112 | + | ||
| 92 | if(host && *host) | 113 | if(host && *host) |
| 93 | { | 114 | { |
| 94 | - v3270_reconnect(widget); | 115 | + if(v3270_reconnect(widget)) |
| 116 | + { | ||
| 117 | + lib3270_trace_event( | ||
| 118 | + v3270_get_session(widget), | ||
| 119 | + "Recconect has failed: %s", | ||
| 120 | + strerror(errno) | ||
| 121 | + ); | ||
| 122 | + } | ||
| 95 | return; | 123 | return; |
| 96 | } | 124 | } |
| 97 | 125 | ||
| 126 | + lib3270_trace_event(v3270_get_session(widget),"No default host, opening dialog"); | ||
| 98 | hostname_action(action,widget); | 127 | hostname_action(action,widget); |
| 128 | + | ||
| 99 | } | 129 | } |
| 100 | 130 | ||
| 101 | static void disconnect_action(GtkAction *action, GtkWidget *widget) | 131 | static void disconnect_action(GtkAction *action, GtkWidget *widget) |