gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23088 - Extractor/src/main


From: gnunet
Subject: [GNUnet-SVN] r23088 - Extractor/src/main
Date: Sat, 4 Aug 2012 03:01:10 +0200

Author: grothoff
Date: 2012-08-04 03:01:10 +0200 (Sat, 04 Aug 2012)
New Revision: 23088

Modified:
   Extractor/src/main/TODO
   Extractor/src/main/extractor.c
   Extractor/src/main/extractor_ipc_gnu.c
   Extractor/src/main/extractor_plugin_main.c
   Extractor/src/main/extractor_plugins.c
Log:
-bugfixes

Modified: Extractor/src/main/TODO
===================================================================
--- Extractor/src/main/TODO     2012-08-04 00:13:37 UTC (rev 23087)
+++ Extractor/src/main/TODO     2012-08-04 01:01:10 UTC (rev 23088)
@@ -3,3 +3,5 @@
 * testcases for extract-from-file, extract-from-gz-file, extract-from-bz2-file
 * testcases for running multiple files in one run (known to fail!)
 
+* MAX_META_DATA buffer of 32 MB is a bit big as a non-growing default size;
+  also, valgrind reports it is leaked even though printf-debugging shows it is 
not (!?)
\ No newline at end of file

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2012-08-04 00:13:37 UTC (rev 23087)
+++ Extractor/src/main/extractor.c      2012-08-04 01:01:10 UTC (rev 23088)
@@ -414,15 +414,21 @@
   while (! done)
     {
       struct EXTRACTOR_Channel *channels[plugin_count];
-      
+
       /* calculate current 'channels' array */
       plugin_count = 0;
       for (pos = plugins; NULL != pos; pos = pos->next)
        {
-         if (-1 != pos->seek_request)
-           channels[plugin_count] = pos->channel;
+         if (-1 == pos->seek_request)
+           {
+             /* channel is not seeking, must be running or done */
+             channels[plugin_count] = pos->channel;
+           }
          else
-           channels[plugin_count] = NULL; /* not running this round, seeking! 
*/
+           {
+             /* not running this round, seeking! */
+             channels[plugin_count] = NULL; 
+           }
          plugin_count++;
        }
       
@@ -438,6 +444,7 @@
          abort_all_channels (plugins);
          break;
        }
+
       /* calculate minimum seek request (or set done=0 to continue here) */
       done = 1;
       min_seek = -1;
@@ -482,24 +489,26 @@
        {
          if (NULL == (channel = pos->channel))
            continue;
+         if ( (-1 != pos->seek_request) && 
+              (1 == prp.file_finished) )
+           {
+             send_discard_message (pos);
+             pos->round_finished = 1;
+             pos->seek_request = -1; 
+           }         
          if ( (-1 != pos->seek_request) && ((last_position > 
pos->seek_request) ||
                (last_position + data_available <= pos->seek_request)) &&
               (min_seek <= pos->seek_request) &&
               ((min_seek + data_available > pos->seek_request) ||
                (min_seek == EXTRACTOR_datasource_get_size_ (ds))) )
            {
+             LOG ("Sending update message\n");
              send_update_message (pos,
                                   min_seek,
                                   data_available,
                                   ds);
-             /*pos->seek_request = -1;*/
+             pos->seek_request = -1; 
            }
-         if ( (-1 != pos->seek_request) && 
-              (1 == prp.file_finished) )
-           {
-             send_discard_message (pos);
-             pos->round_finished = 1;
-           }         
          if (0 == pos->round_finished)
            done = 0; /* can't be done, plugin still active */  
        }
@@ -576,10 +585,11 @@
   have_oop = 0;
   for (pos = plugins; NULL != pos; pos = pos->next)
     {
-      if (NULL != (shm = pos->shm))
-       break;
+      if (NULL == shm)
+       shm = pos->shm;
       if (EXTRACTOR_OPTION_IN_PROCESS != pos->flags)
        have_oop = 1;
+      pos->round_finished = 0;
     }
   if ( (NULL == shm) &&
        (1 == have_oop) )

Modified: Extractor/src/main/extractor_ipc_gnu.c
===================================================================
--- Extractor/src/main/extractor_ipc_gnu.c      2012-08-04 00:13:37 UTC (rev 
23087)
+++ Extractor/src/main/extractor_ipc_gnu.c      2012-08-04 01:01:10 UTC (rev 
23088)
@@ -236,6 +236,7 @@
                                     size);
 }
 
+
 /**
  * Query datasource for current position
  *
@@ -251,6 +252,7 @@
   return pos;
 }
 
+
 /**
  * Create a channel to communicate with a process wrapping
  * the plugin of the given name.  Starts the process as well.
@@ -440,7 +442,10 @@
        max = channel->cpipe_out;
     }
   if (-1 == max)
-    return 1; /* nothing left to do! */
+    {
+      LOG ("No channels to select on...\n");
+      return 1; /* nothing left to do! */
+    }
   tv.tv_sec = 10;
   tv.tv_usec = 0;
   if (-1 == select (max + 1, &to_check, NULL, NULL, &tv))

Modified: Extractor/src/main/extractor_plugin_main.c
===================================================================
--- Extractor/src/main/extractor_plugin_main.c  2012-08-04 00:13:37 UTC (rev 
23087)
+++ Extractor/src/main/extractor_plugin_main.c  2012-08-04 01:01:10 UTC (rev 
23088)
@@ -318,8 +318,13 @@
       LOG ("Failed to read response to meta message\n");
       return 1;
     }
+  if (MESSAGE_DISCARD_STATE == reply)
+    return 1;
   if (MESSAGE_CONTINUE_EXTRACTING != reply)
-    return 1;
+    {
+      LOG ("Received unexpected reply to meta data: %d\n", reply);
+      return 1;
+    }
   return 0;
 }
 
@@ -467,7 +472,7 @@
   while (1)
     {
       unsigned char code;
-  
+
       if (1 != EXTRACTOR_read_all_ (pc->in, &code, 1))
        {
          LOG ("Failed to read next request\n");
@@ -477,12 +482,20 @@
        {
        case MESSAGE_INIT_STATE:
          if (0 != handle_init_message (pc))
-           return;
+           {
+             LOG ("Failure to handle INIT\n");
+             return;
+           }
          break;
        case MESSAGE_EXTRACT_START:
          if (0 != handle_start_message (pc))
-           return;
+           {
+             LOG ("Failure to handle START\n");
+             return;
+           }
+         break;
        case MESSAGE_UPDATED_SHM:
+         LOG ("Illegal message\n");
          /* not allowed here, we're not waiting for SHM to move! */
          return;
        case MESSAGE_DISCARD_STATE:
@@ -579,6 +592,8 @@
   pc.shm = NULL;
   pc.shm_map_size = 0;
   process_requests (&pc);
+  LOG ("IPC error; plugin `%s' terminates!\n",
+       plugin->short_libname);
 #if WINDOWS
   if (NULL != pc.shm)
     UnmapViewOfFile (pc.shm);

Modified: Extractor/src/main/extractor_plugins.c
===================================================================
--- Extractor/src/main/extractor_plugins.c      2012-08-04 00:13:37 UTC (rev 
23087)
+++ Extractor/src/main/extractor_plugins.c      2012-08-04 01:01:10 UTC (rev 
23088)
@@ -208,7 +208,7 @@
                      const char *options,
                      enum EXTRACTOR_Options flags)
 {
-  struct EXTRACTOR_PluginList *result;
+  struct EXTRACTOR_PluginList *plugin;
   struct EXTRACTOR_PluginList *pos;
   char *libname;
 
@@ -221,22 +221,23 @@
           library);
       return prev;
     }
-  if (NULL == (result = malloc (sizeof (struct EXTRACTOR_PluginList))))
+  if (NULL == (plugin = malloc (sizeof (struct EXTRACTOR_PluginList))))
     return prev;
-  memset (result, 0, sizeof (struct EXTRACTOR_PluginList));
-  result->next = prev;
-  if (NULL == (result->short_libname = strdup (library)))
+  memset (plugin, 0, sizeof (struct EXTRACTOR_PluginList));
+  plugin->next = prev;
+  if (NULL == (plugin->short_libname = strdup (library)))
     {
-      free (result);
+      free (plugin);
       return NULL;
     }
-  result->libname = libname;
-  result->flags = flags;
+  plugin->libname = libname;
+  plugin->flags = flags;
   if (NULL != options)
-    result->plugin_options = strdup (options);
+    plugin->plugin_options = strdup (options);
   else
-    result->plugin_options = NULL;
-  return result;
+    plugin->plugin_options = NULL;
+  plugin->seek_request = -1;
+  return plugin;
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]