commit 49f07868075671f5355b5e034a3cd5cd74005734
parent 44c7bc946fbff237e6b464d8f08debbbf9fb6946
Author: LRN <lrn1986@gmail.com>
Date: Sun, 22 Dec 2013 20:53:19 +0000
Channel-killing logic for W32
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git 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,
unsigned int c;
char *ndata;
HANDLE events[MAXIMUM_WAIT_OBJECTS];
+ int closed_channel;
c = 0;
for (i = 0; i < num_channels; i++)
@@ -730,6 +731,26 @@ EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels,
if (first_ready == WAIT_TIMEOUT || first_ready == WAIT_FAILED)
{
/* an error or timeout -> something's wrong or all plugins hung up */
+ closed_channel = 0;
+ for (i = 0; i < num_channels; i++)
+ {
+ struct EXTRACTOR_Channel *channel = channels[i];
+ if (NULL == channel)
+ continue;
+ if (-1 == channel->plugin->seek_request)
+ {
+ /* plugin blocked for too long, kill the channel */
+ LOG ("Channel blocked, closing channel to %s\n",
+ channel->plugin->libname);
+ channel->plugin->channel = NULL;
+ channel->plugin->round_finished = 1;
+ EXTRACTOR_IPC_channel_destroy_ (channel);
+ channels[i] = NULL;
+ closed_channel = 1;
+ }
+ }
+ if (1 == closed_channel)
+ return 1;
LOG_STRERROR ("WaitForMultipleObjects");
return -1;
}