gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r23115 - Extractor/src/main
Date: Sun, 5 Aug 2012 20:29:23 +0200

Author: grothoff
Date: 2012-08-05 20:29:23 +0200 (Sun, 05 Aug 2012)
New Revision: 23115

Modified:
   Extractor/src/main/extractor.c
   Extractor/src/main/extractor_ipc.c
   Extractor/src/main/extractor_ipc_gnu.c
   Extractor/src/main/extractor_plugin_main.c
   Extractor/src/main/test2_extractor.c
Log:
fixing two bugs

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2012-08-05 15:40:47 UTC (rev 23114)
+++ Extractor/src/main/extractor.c      2012-08-05 18:29:23 UTC (rev 23115)
@@ -458,8 +458,14 @@
       plugin_count = 0;
       for (pos = plugins; NULL != pos; pos = pos->next)
        {
-         if (NULL == channels[plugin_count])
-           pos->channel = NULL;
+         if ( (NULL == channels[plugin_count]) &&
+              (-1 == pos->seek_request) )
+           {
+             /* EXTRACTOR_IPC_channel_recv_ got a non-NULL channel (-1 == 
seek_request)
+                but set it to NULL; that means the channel had an IPC error 
and was closed;
+                so we need to update the plugin accordingly */
+             pos->channel = NULL;
+           }
          plugin_count++;
          if ( (1 == pos->round_finished) ||
               (NULL == pos->channel) )
@@ -495,6 +501,7 @@
                }
            }
        }
+      data_available = -1;
       if ( (1 == done) &&
           (-1 != min_seek) )
        {
@@ -516,7 +523,10 @@
       for (pos = plugins; NULL != pos; pos = pos->next)
        {
          if (NULL == (channel = pos->channel))
-           continue;
+           {
+             /* Skipping plugin: channel down */
+             continue;
+           }     
          if ( (-1 != pos->seek_request) && 
               (1 == prp.file_finished) )
            {
@@ -524,11 +534,13 @@
              pos->round_finished = 1;
              pos->seek_request = -1; 
            }         
-         if ( (-1 != pos->seek_request) && 
+         if ( (-1 != data_available) &&
+              (-1 != pos->seek_request) && 
               (min_seek <= pos->seek_request) &&
               ( (min_seek + data_available > pos->seek_request) ||
                 (min_seek == EXTRACTOR_datasource_get_size_ (ds, 0))) )
            {
+             /* Notify plugin about seek to 'min_seek' */
              send_update_message (pos,
                                   min_seek,
                                   data_available,

Modified: Extractor/src/main/extractor_ipc.c
===================================================================
--- Extractor/src/main/extractor_ipc.c  2012-08-05 15:40:47 UTC (rev 23114)
+++ Extractor/src/main/extractor_ipc.c  2012-08-05 18:29:23 UTC (rev 23115)
@@ -85,7 +85,7 @@
              return -1; /* not allowing more than MAX_META_DATA meta data */
            }
          if (size < sizeof (meta) + meta.mime_length + meta.value_size)
-           {
+           { 
              plugin->seek_request = -1;
              return 0;
            }

Modified: Extractor/src/main/extractor_ipc_gnu.c
===================================================================
--- Extractor/src/main/extractor_ipc_gnu.c      2012-08-05 15:40:47 UTC (rev 
23114)
+++ Extractor/src/main/extractor_ipc_gnu.c      2012-08-05 18:29:23 UTC (rev 
23115)
@@ -508,6 +508,7 @@
        {
          if (-1 == iret)
            LOG_STRERROR ("read");
+         LOG ("Read error from channel, closing channel %d\n", i+1);
          EXTRACTOR_IPC_channel_destroy_ (channel);
          channels[i] = NULL;
        }

Modified: Extractor/src/main/extractor_plugin_main.c
===================================================================
--- Extractor/src/main/extractor_plugin_main.c  2012-08-05 15:40:47 UTC (rev 
23114)
+++ Extractor/src/main/extractor_plugin_main.c  2012-08-05 18:29:23 UTC (rev 
23115)
@@ -194,7 +194,8 @@
       EXTRACTOR_read_all_ (pc->in,
                           &reply, sizeof (reply)))
     {
-      LOG ("Failed to read response to MESSAGE_SEEK\n");
+      LOG ("Plugin `%s' failed to read response to MESSAGE_SEEK\n",
+          pc->plugin->short_libname);
       return -1;
     }
   if (MESSAGE_UPDATED_SHM != reply)    
@@ -215,7 +216,7 @@
       /* convert offset to be absolute from beginning of the file */
       npos = pc->file_size - npos;
     }
-  if ( (pc->shm_off <= npos) &&
+   if ( (pc->shm_off <= npos) &&
        ((pc->shm_off + pc->shm_ready_bytes > npos) ||
        (pc->file_size == pc->shm_off)) )
     {
@@ -224,7 +225,8 @@
     }
   /* oops, serious missunderstanding, we asked to seek
      and then were notified about a different position!? */
-  LOG ("Got invalid MESSAGE_UPDATED_SHM in response to my %d-seek (%llu not in 
%llu-%llu)\n",
+  LOG ("Plugin `%s' got invalid MESSAGE_UPDATED_SHM in response to my %d-seek 
(%llu not in %llu-%llu)\n",
+       pc->plugin->short_libname,
        (int) wval,
        (unsigned long long) npos,
        (unsigned long long) pc->shm_off,

Modified: Extractor/src/main/test2_extractor.c
===================================================================
--- Extractor/src/main/test2_extractor.c        2012-08-05 15:40:47 UTC (rev 
23114)
+++ Extractor/src/main/test2_extractor.c        2012-08-05 18:29:23 UTC (rev 
23115)
@@ -123,23 +123,6 @@
       fprintf (stderr, "Unexpected data at offset 150k - 3\n");
       ABORT ();
     }
-  if (0 != ec->proc (ec->cls, "test2", EXTRACTOR_METATYPE_COMMENT,
-      EXTRACTOR_METAFORMAT_UTF8, "<no mime>", "Hello world!",
-      strlen ("Hello world!") + 1))
-    {
-      fprintf (stderr, "Unexpected return value from 'proc'\n");
-      ABORT ();
-    }
-  /* The test assumes that client orders us to stop extraction
-   * after seeing "Goodbye!".
-   */
-  if (1 != ec->proc (ec->cls, "test2", EXTRACTOR_METATYPE_COMMENT,
-      EXTRACTOR_METAFORMAT_UTF8, "<no mime>", "Goodbye!",
-      strlen ("Goodbye!") + 1))
-    {
-      fprintf (stderr, "Unexpected return value from 'proc'\n");
-      ABORT ();
-    }
 }
 
 /* end of test2_extractor.c */




reply via email to

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