From b6fec63006df1157a7e55acdc39d39b3684a156f Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 20 Feb 2018 13:37:49 -0300 Subject: [PATCH] Corrigindo timeout invalido durante a transferĂȘncia de arquivos VM/CMS. --- locale/pw3270.pot | 4 ++-- src/pw3270/v3270ft/v3270ftprogress.c | 53 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/locale/pw3270.pot b/locale/pw3270.pot index ec8443d..77ed867 100644 --- a/locale/pw3270.pot +++ b/locale/pw3270.pot @@ -9,7 +9,7 @@ msgstr "" "#-#-#-#-# lib3270.pot (PACKAGE VERSION) #-#-#-#-#\n" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-15 14:26-0200\n" +"POT-Creation-Date: 2018-02-14 15:16-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,7 +20,7 @@ msgstr "" "#-#-#-#-# pw3270.pot (PACKAGE VERSION) #-#-#-#-#\n" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-15 14:26-0200\n" +"POT-Creation-Date: 2018-02-14 15:16-0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/pw3270/v3270ft/v3270ftprogress.c b/src/pw3270/v3270ft/v3270ftprogress.c index 5751d2e..7695d0a 100644 --- a/src/pw3270/v3270ft/v3270ftprogress.c +++ b/src/pw3270/v3270ft/v3270ftprogress.c @@ -497,43 +497,54 @@ void v3270ftprogress_update(GtkWidget *widget, unsigned long current, unsigned l gchar * text; v3270ftprogress * dialog = GTK_V3270FTPROGRESS(widget); - if(current && total) { + if(current) { - if(dialog->pulse) { - g_source_destroy(dialog->pulse); - dialog->pulse = NULL; - } + // Tem dados, atualiza + dialog->timeout = time(NULL) + 10; - double remaining = ((double) (total - current))/1024.0; + if(total) { - if(remaining > 0 && kbytes_sec > 0) { + if(dialog->pulse) { + g_source_destroy(dialog->pulse); + dialog->pulse = NULL; + } - char buffer[40]; - double seconds = ((double) remaining) / kbytes_sec; - time_t eta = time(0) + ((time_t) seconds); - strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); + double remaining = ((double) (total - current))/1024.0; - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer); + if(remaining > 0 && kbytes_sec > 0) { - } else { + char buffer[40]; + double seconds = ((double) remaining) / kbytes_sec; + time_t eta = time(0) + ((time_t) seconds); + strftime(buffer, 39, "%H:%M:%S", localtime(&eta)); - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],"-"); + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],buffer); - } + } else { + + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_ETA],"-"); + + } - gtk_progress_bar_set_fraction(dialog->progress, ((gdouble) current) / ((gdouble) total)); + gtk_progress_bar_set_fraction(dialog->progress, ((gdouble) current) / ((gdouble) total)); + + } } - debug("%s(%lu/%lu)",__FUNCTION__,current,total); + debug("%s(current=%lu total=%lu kbytes/sec=%u)",__FUNCTION__,current,total,(unsigned int) kbytes_sec); text = g_strdup_printf("%lu",current); gtk_entry_set_text(dialog->info[PROGRESS_FIELD_CURRENT],text); g_free(text); - text = g_strdup_printf("%lu",total); - gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],text); - g_free(text); + if(total) { + text = g_strdup_printf("%lu",total); + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],text); + g_free(text); + } else { + gtk_entry_set_text(dialog->info[PROGRESS_FIELD_TOTAL],_("N/A")); + } text = g_strdup_printf("%ld KB/s",(unsigned long) kbytes_sec); gtk_entry_set_text(dialog->info[PROGRESS_FIELD_SPEED],text); @@ -689,6 +700,7 @@ static void ft_update(H3270 *hSession, unsigned long current, unsigned long tota } static void ft_running(H3270 *hSession, int is_cut, void *widget) { + debug("%s",__FUNCTION__); GTK_V3270FTPROGRESS(widget)->timeout = time(NULL)+10; } @@ -719,6 +731,7 @@ static gboolean do_timer(v3270ftprogress *dialog) { if(time(NULL) > dialog->timeout) { + debug("%s: Dialog timeout",__FUNCTION__); v3270ftprogress_set_header(GTK_WIDGET(dialog),strerror(ETIMEDOUT)); stop_pulse(dialog); -- libgit2 0.21.2