aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-22 20:53:19 +0000
committerLRN <lrn1986@gmail.com>2013-12-22 20:53:19 +0000
commit49f07868075671f5355b5e034a3cd5cd74005734 (patch)
treeae68313e718a5320ee9413541af80216fae1deb9
parent44c7bc946fbff237e6b464d8f08debbbf9fb6946 (diff)
downloadlibextractor-49f07868075671f5355b5e034a3cd5cd74005734.tar.gz
libextractor-49f07868075671f5355b5e034a3cd5cd74005734.zip
Channel-killing logic for W32
-rw-r--r--src/main/extractor_ipc_w32.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/extractor_ipc_w32.c b/src/main/extractor_ipc_w32.c
index c4b8284..5d40b40 100644
--- a/src/main/extractor_ipc_w32.c
+++ b/src/main/extractor_ipc_w32.c
@@ -695,6 +695,7 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
695 unsigned int c; 695 unsigned int c;
696 char *ndata; 696 char *ndata;
697 HANDLE events[MAXIMUM_WAIT_OBJECTS]; 697 HANDLE events[MAXIMUM_WAIT_OBJECTS];
698 int closed_channel;
698 699
699 c = 0; 700 c = 0;
700 for (i = 0; i < num_channels; i++) 701 for (i = 0; i < num_channels; i++)
@@ -730,6 +731,26 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
730 if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED) 731 if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED)
731 { 732 {
732 /* an error or timeout -> something's wrong or all plugins hung up */ 733 /* an error or timeout -> something's wrong or all plugins hung up */
734 closed_channel = 0;
735 for (i = 0; i < num_channels; i++)
736 {
737 struct EXTRACTOR_Channel *channel = channels[i];
738 if (NULL == channel)
739 continue;
740 if (-1 == channel->plugin->seek_request)
741 {
742 /* plugin blocked for too long, kill the channel */
743 LOG ("Channel blocked, closing channel to %s\n",
744 channel->plugin->libname);
745 channel->plugin->channel = NULL;
746 channel->plugin->round_finished = 1;
747 EXTRACTOR_IPC_channel_destroy_ (channel);
748 channels[i] = NULL;
749 closed_channel = 1;
750 }
751 }
752 if (1 == closed_channel)
753 return 1;
733 LOG_STRERROR ("WaitForMultipleObjects"); 754 LOG_STRERROR ("WaitForMultipleObjects");
734 return -1; 755 return -1;
735 } 756 }