[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4749 - GNUnet/src/applications/fs/fsui GNUnet/src/applicat
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4749 - GNUnet/src/applications/fs/fsui GNUnet/src/applications/fs/tools gnunet-gtk/src/plugins/fs |
Date: |
Sun, 15 Apr 2007 19:30:10 -0600 (MDT) |
Author: grothoff
Date: 2007-04-15 19:30:10 -0600 (Sun, 15 Apr 2007)
New Revision: 4749
Modified:
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
gnunet-gtk/src/plugins/fs/fs.h
gnunet-gtk/src/plugins/fs/upload.c
Log:
fixing Mantis 1194 and potential crash
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2007-04-15 22:14:13 UTC (rev
4748)
+++ GNUnet/src/applications/fs/fsui/upload.c 2007-04-16 01:30:10 UTC (rev
4749)
@@ -44,6 +44,10 @@
void * ptr) {
FSUI_UploadList * utc = ptr;
FSUI_Event event;
+ unsigned long long subtotal;
+ FSUI_UploadList * pos;
+ cron_t xeta;
+ cron_t now;
event.type = FSUI_upload_progress;
event.data.UploadProgress.uc.pos = utc;
@@ -57,6 +61,25 @@
utc->completed = completedBytes;
utc->shared->ctx->ecb(utc->shared->ctx->ecbClosure,
&event);
+ if (utc->parent != &utc->shared->ctx->activeUploads) {
+ subtotal = 0;
+ pos = utc->parent->child;
+ while (pos != NULL) {
+ subtotal += pos->completed;
+ pos = pos->next;
+ }
+ now = get_time();
+ xeta = now;
+ if (subtotal > 0) {
+ xeta = (cron_t) (utc->parent->start_time +
+ (((double)(now -
utc->parent->start_time)/(double)subtotal))
+ * (double)utc->parent->total);
+ }
+ progressCallback(utc->parent->total,
+ subtotal,
+ xeta,
+ utc->parent);
+ }
}
static int testTerminate(void * cls) {
@@ -152,7 +175,7 @@
len)) {
GE_LOG_STRERROR_FILE(ee,
GE_ERROR | GE_USER | GE_BULK,
- "write",
+ "write",
tempName);
*error = STRDUP(GE_memory_get(mem, 0));
GE_free_context(ee);
@@ -248,7 +271,7 @@
error);
FREE(error);
return NULL;
- }
+ }
} else {
filename = STRDUP(utc->filename);
}
@@ -461,6 +484,7 @@
ECRS_freeMetaData(md);
if (child == NULL)
return SYSERR;
+ parent->total += child->total;
return OK;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2007-04-15 22:14:13 UTC
(rev 4748)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2007-04-16 01:30:10 UTC
(rev 4749)
@@ -248,7 +248,7 @@
GNUNET_SHUTDOWN_INITIATE();
break;
case FSUI_upload_error:
- printf(_("\nError uploading file: %s\n"),
+ printf(_("\nError uploading file: %s"),
event->data.UploadError.message);
errorCode = 3;
GNUNET_SHUTDOWN_INITIATE();
Modified: gnunet-gtk/src/plugins/fs/fs.h
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.h 2007-04-15 22:14:13 UTC (rev 4748)
+++ gnunet-gtk/src/plugins/fs/fs.h 2007-04-16 01:30:10 UTC (rev 4749)
@@ -294,6 +294,8 @@
int has_terminated;
+ int is_top;
+
} UploadList;
extern struct FSUI_Context * ctx;
Modified: gnunet-gtk/src/plugins/fs/upload.c
===================================================================
--- gnunet-gtk/src/plugins/fs/upload.c 2007-04-15 22:14:13 UTC (rev 4748)
+++ gnunet-gtk/src/plugins/fs/upload.c 2007-04-16 01:30:10 UTC (rev 4749)
@@ -150,6 +150,7 @@
ret->filename = STRDUP(filename);
ret->fsui_list = fsui;
ret->total = total;
+ ret->is_top = parent == NULL;
if ( (parent != NULL) &&
(NULL != (path =
gtk_tree_row_reference_get_path(parent->summaryViewRowReference))) ) {
gtk_tree_model_get_iter(GTK_TREE_MODEL(upload_summary),
@@ -558,7 +559,8 @@
iter,
UPLOAD_INTERNAL, &ul,
-1);
- if (ul->has_terminated) {
+ if ( (ul->has_terminated) &&
+ (ul->is_top) ) {
fcbc.method = &FSUI_stopUpload;
fcbc.argument = ul->fsui_list;
run_with_save_calls(&fsui_callback,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4749 - GNUnet/src/applications/fs/fsui GNUnet/src/applications/fs/tools gnunet-gtk/src/plugins/fs,
gnunet <=