[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7354 - GNUnet/src/applications/fs/tools
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7354 - GNUnet/src/applications/fs/tools |
Date: |
Fri, 27 Jun 2008 18:29:22 -0600 (MDT) |
Author: grothoff
Date: 2008-06-27 18:29:22 -0600 (Fri, 27 Jun 2008)
New Revision: 7354
Modified:
GNUnet/src/applications/fs/tools/gnunet-auto-share.c
Log:
fixing 1375
Modified: GNUnet/src/applications/fs/tools/gnunet-auto-share.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-06-27
22:55:00 UTC (rev 7353)
+++ GNUnet/src/applications/fs/tools/gnunet-auto-share.c 2008-06-28
00:29:22 UTC (rev 7354)
@@ -111,6 +111,16 @@
switch (event->type)
{
case GNUNET_FSUI_upload_progress:
+ if ( (*verboselevel > 2) &&
+ (event->data.UploadProgress.uc.pos != ul) )
+ {
+ fprintf (myout,
+ _("Upload of `%s' at %llu out of %llu bytes.\n"),
+ event->data.UploadProgress.filename,
+ event->data.UploadProgress.completed,
+ event->data.UploadProgress.total);
+ fflush (myout);
+ }
break;
case GNUNET_FSUI_upload_completed:
if (*verboselevel)
@@ -127,24 +137,56 @@
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_aborted:
- fprintf (myout, _("\nUpload aborted.\n"));
+ fprintf (myout, _("Upload aborted.\n"));
fflush (myout);
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_error:
fprintf (myout,
- _("\nError uploading file: %s"),
+ _("Error uploading file: %s\n"),
event->data.UploadError.message);
fflush (myout);
upload_done = GNUNET_YES;
break;
case GNUNET_FSUI_upload_started:
+ if ( (*verboselevel > 1) &&
+ (ul == NULL) )
+ {
+ fprintf (myout,
+ _("Starting upload of `%s'.\n"),
+ event->data.UploadStarted.filename);
+ fflush (myout);
+ }
+ break;
case GNUNET_FSUI_upload_stopped:
+ break;
case GNUNET_FSUI_upload_suspended:
+ if ( (ul != NULL) &&
+ (event->data.UploadSuspended.uc.pos == ul) )
+ {
+ fprintf (myout, _("Uploading suspended.\n"));
+ fflush (myout);
+ ul = NULL;
+ }
+ break;
case GNUNET_FSUI_upload_resumed:
+ if (ul == NULL)
+ {
+ ul = event->data.UploadResumed.uc.pos;
+ if (GNUNET_FSUI_ACTIVE != event->data.UploadResumed.state)
+ {
+ upload_done = GNUNET_YES;
+ }
+ else
+ {
+ fprintf (myout, _("Uploading `%s' resumed.\n"),
+ event->data.UploadResumed.filename);
+ fflush (myout);
+ }
+ }
break;
default:
- fprintf (myout, _("\nUnexpected event: %d\n"), event->type);
+ fprintf (myout, _("Unexpected event: %d\n"), event->type);
fflush (myout);
GNUNET_GE_BREAK (ectx, 0);
break;
@@ -662,7 +704,7 @@
GNUNET_terminal_detach_complete (ectx, filedes, GNUNET_YES);
GNUNET_free (metafn);
/* fundamental init */
- ctx = GNUNET_FSUI_start (ectx, cfg, "gnunet-auto-share", GNUNET_NO, 32,
+ ctx = GNUNET_FSUI_start (ectx, cfg, "gnunet-auto-share", GNUNET_YES, 32,
&printstatus, &verbose);
dirs_idx1 = dirs_idx2 = dirs;
@@ -696,23 +738,38 @@
{
work_done = GNUNET_NO;
GNUNET_thread_sleep (250 * GNUNET_CRON_MILLISECONDS);
- pos = head;
- while ((pos != NULL) && (GNUNET_NO == GNUNET_shutdown_test ()))
- {
- GNUNET_disk_directory_scan (ectx, pos->dirname, &probe_directory,
- pos);
- if (GNUNET_YES == upload_done)
- {
- work_done = GNUNET_YES;
- GNUNET_FSUI_upload_abort (ul);
- GNUNET_FSUI_upload_stop (ul);
- upload_done = GNUNET_NO;
- ul = NULL;
- }
- pos = pos->next;
- }
+ if (ul == NULL)
+ {
+ pos = head;
+ while ((pos != NULL) && (GNUNET_NO == GNUNET_shutdown_test ()))
+ {
+ GNUNET_disk_directory_scan (ectx, pos->dirname, &probe_directory,
+ pos);
+ if (GNUNET_YES == upload_done)
+ {
+ work_done = GNUNET_YES;
+ GNUNET_FSUI_upload_abort (ul);
+ GNUNET_FSUI_upload_stop (ul);
+ upload_done = GNUNET_NO;
+ ul = NULL;
+ }
+ pos = pos->next;
+ }
+ }
+ else
+ {
+ if (GNUNET_YES == upload_done)
+ {
+ work_done = GNUNET_YES;
+ GNUNET_FSUI_upload_abort (ul);
+ GNUNET_FSUI_upload_stop (ul);
+ upload_done = GNUNET_NO;
+ ul = NULL;
+ }
+ }
if ((ul == NULL) &&
- (work_done == GNUNET_NO) && (GNUNET_NO == GNUNET_shutdown_test ()))
+ (work_done == GNUNET_NO) &&
+ (GNUNET_NO == GNUNET_shutdown_test ()))
{
GNUNET_thread_sleep (delay);
delay *= 2;
@@ -852,6 +909,16 @@
int i;
int errorCode;
char *log_file_name;
+ char *dirs;
+ unsigned int dirs_len;
+ char *fullname;
+ struct stat stbuf;
+ const char *dirs_idx1;
+ char *dirs_idx2;
+ char *base;
+ int seen;
+ int added;
+ int do_break;
errorCode = 0;
myout = stdout;
@@ -867,16 +934,6 @@
if (i < argc)
{
- char *dirs;
- unsigned int dirs_len;
- char *fullname;
- struct stat stbuf;
- const char *dirs_idx1;
- char *dirs_idx2;
- char *base;
- int seen;
- int added;
-
GNUNET_GC_get_configuration_value_string (cfg, "GNUNET-AUTO-SHARE",
"DIRS", "", &dirs);
dirs_len = strlen (dirs);
@@ -900,7 +957,8 @@
{
if ((*dirs_idx2 == ';') || (*dirs_idx2 == '\0'))
{
- *dirs_idx2 = 0;
+ do_break = ('\0' == *dirs_idx2);
+ *dirs_idx2 = '\0';
if (0 == strcmp (dirs_idx1, fullname))
{
seen = 1;
@@ -910,8 +968,13 @@
fullname);
break;
}
- if (*dirs_idx2 == 0)
- break;
+ else
+ fprintf(stderr,
+ "No match between `%s' and `%s'\n",
+ fullname,
+ dirs_idx1);
+ if (do_break)
+ break;
dirs_idx1 = ++dirs_idx2;
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7354 - GNUnet/src/applications/fs/tools,
gnunet <=