aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-22 17:55:45 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-22 17:55:45 +0000
commit57d560a6f3a4b65d77fea261e11b58858331ae3a (patch)
tree4879d0380097321c90f89380f443a90c0889fbcb
parentd26a892396ed78f041c23a974ae1b2502004a0f7 (diff)
downloadlibextractor-57d560a6f3a4b65d77fea261e11b58858331ae3a.tar.gz
libextractor-57d560a6f3a4b65d77fea261e11b58858331ae3a.zip
fixing issue with one plugin blocking processing preventing others from ever seeking -- GNU only
-rw-r--r--src/main/extractor_ipc_gnu.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c
index 313120f..9aa8a88 100644
--- a/src/main/extractor_ipc_gnu.c
+++ b/src/main/extractor_ipc_gnu.c
@@ -447,6 +447,7 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
447 ssize_t ret; 447 ssize_t ret;
448 ssize_t iret; 448 ssize_t iret;
449 char *ndata; 449 char *ndata;
450 int closed_channel;
450 451
451 FD_ZERO (&to_check); 452 FD_ZERO (&to_check);
452 max = -1; 453 max = -1;
@@ -468,6 +469,27 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
468 if (0 >= select (max + 1, &to_check, NULL, NULL, &tv)) 469 if (0 >= select (max + 1, &to_check, NULL, NULL, &tv))
469 { 470 {
470 /* an error or timeout -> something's wrong or all plugins hung up */ 471 /* an error or timeout -> something's wrong or all plugins hung up */
472 closed_channel = 0;
473 for (i=0;i<num_channels;i++)
474 {
475 channel = channels[i];
476 if (NULL == channel)
477 continue;
478 if (-1 == channel->plugin->seek_request)
479 {
480 /* plugin blocked for too long, kill channel */
481 LOG ("Channel blocked, closing channel to %s\n",
482 channel->plugin->libname);
483 channel->plugin->channel = NULL;
484 channel->plugin->round_finished = 1;
485 EXTRACTOR_IPC_channel_destroy_ (channel);
486 channels[i] = NULL;
487 closed_channel = 1;
488 }
489 }
490 if (1 == closed_channel)
491 return 1;
492 /* strange, no channel is to blame, let's die just to be safe */
471 if ((EINTR != errno) && (0 != errno)) 493 if ((EINTR != errno) && (0 != errno))
472 LOG_STRERROR ("select"); 494 LOG_STRERROR ("select");
473 return -1; 495 return -1;
@@ -511,7 +533,8 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
511 { 533 {
512 if (-1 == iret) 534 if (-1 == iret)
513 LOG_STRERROR ("read"); 535 LOG_STRERROR ("read");
514 LOG ("Read error from channel, closing channel %d\n", i+1); 536 LOG ("Read error from channel, closing channel %s\n",
537 channel->plugin->libname);
515 EXTRACTOR_IPC_channel_destroy_ (channel); 538 EXTRACTOR_IPC_channel_destroy_ (channel);
516 channels[i] = NULL; 539 channels[i] = NULL;
517 } 540 }