X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=liblttng-consumer%2Flttng-consumer.c;h=54338e800619a728f70ca44673c6f346a0ebecc0;hp=de15dd3b72379276cd0d934e79f2435ef67dbb8a;hb=d056b47720cf547dd8c4ca59076ffcd215d58f2c;hpb=1c3c14ace23b807f049d036b5719093b3bdd6aa6 diff --git a/liblttng-consumer/lttng-consumer.c b/liblttng-consumer/lttng-consumer.c index de15dd3b7..54338e800 100644 --- a/liblttng-consumer/lttng-consumer.c +++ b/liblttng-consumer/lttng-consumer.c @@ -847,7 +847,21 @@ void *lttng_consumer_thread_poll_fds(void *data) num_hup++; } else if ((pollfd[i].revents & POLLHUP) && !(pollfd[i].revents & POLLIN)) { - DBG("Polling fd %d tells it has hung up.", pollfd[i].fd); + if (consumer_data.type == LTTNG_CONSUMER_UST) { + DBG("Polling fd %d tells it has hung up. Attempting flush and read.", + pollfd[i].fd); + if (!local_stream[i]->hangup_flush_done) { + lttng_ustconsumer_on_stream_hangup(local_stream[i]); + /* try reading after flush */ + ret = ctx->on_buffer_ready(local_stream[i], ctx); + /* it's ok to have an unavailable sub-buffer */ + if (ret == EAGAIN) { + ret = 0; + } + } + } else { + DBG("Polling fd %d tells it has hung up.", pollfd[i].fd); + } consumer_del_stream(local_stream[i]); num_hup++; }