|
|
407095 |
From 3be828e91c619be5694840e61121861a8be42843 Mon Sep 17 00:00:00 2001
|
|
|
407095 |
From: Wim Taymans <wim.taymans@gmail.com>
|
|
|
407095 |
Date: Mon, 18 Nov 2013 21:39:54 +0100
|
|
|
407095 |
Subject: [PATCH 2/2] pluginloader: check read/write before closed
|
|
|
407095 |
|
|
|
407095 |
first try to read or write on the socket before checking the closed state. This
|
|
|
407095 |
makes sure we handle all data on the socket before erroring out.
|
|
|
407095 |
---
|
|
|
407095 |
gst/gstpluginloader.c | 16 ++++++++++------
|
|
|
407095 |
1 file changed, 10 insertions(+), 6 deletions(-)
|
|
|
407095 |
|
|
|
407095 |
diff --git a/gst/gstpluginloader.c b/gst/gstpluginloader.c
|
|
|
407095 |
index 4109192..51a04d2 100644
|
|
|
407095 |
--- a/gst/gstpluginloader.c
|
|
|
407095 |
+++ b/gst/gstpluginloader.c
|
|
|
407095 |
@@ -996,27 +996,31 @@ exchange_packets (GstPluginLoader * l)
|
|
|
407095 |
l->tx_buf_write - l->tx_buf_read);
|
|
|
407095 |
|
|
|
407095 |
if (!l->rx_done) {
|
|
|
407095 |
- if (gst_poll_fd_has_error (l->fdset, &l->fd_r) ||
|
|
|
407095 |
- gst_poll_fd_has_closed (l->fdset, &l->fd_r)) {
|
|
|
407095 |
- GST_LOG ("read fd %d closed/errored", l->fd_r.fd);
|
|
|
407095 |
+ if (gst_poll_fd_has_error (l->fdset, &l->fd_r)) {
|
|
|
407095 |
+ GST_LOG ("read fd %d errored", l->fd_r.fd);
|
|
|
407095 |
goto fail_and_cleanup;
|
|
|
407095 |
}
|
|
|
407095 |
|
|
|
407095 |
if (gst_poll_fd_can_read (l->fdset, &l->fd_r)) {
|
|
|
407095 |
if (!read_one (l))
|
|
|
407095 |
goto fail_and_cleanup;
|
|
|
407095 |
+ } else if (gst_poll_fd_has_closed (l->fdset, &l->fd_r)) {
|
|
|
407095 |
+ GST_LOG ("read fd %d closed", l->fd_r.fd);
|
|
|
407095 |
+ goto fail_and_cleanup;
|
|
|
407095 |
}
|
|
|
407095 |
}
|
|
|
407095 |
|
|
|
407095 |
if (l->tx_buf_read < l->tx_buf_write) {
|
|
|
407095 |
- if (gst_poll_fd_has_error (l->fdset, &l->fd_w) ||
|
|
|
407095 |
- gst_poll_fd_has_closed (l->fdset, &l->fd_r)) {
|
|
|
407095 |
- GST_ERROR ("write fd %d closed/errored", l->fd_w.fd);
|
|
|
407095 |
+ if (gst_poll_fd_has_error (l->fdset, &l->fd_w)) {
|
|
|
407095 |
+ GST_ERROR ("write fd %d errored", l->fd_w.fd);
|
|
|
407095 |
goto fail_and_cleanup;
|
|
|
407095 |
}
|
|
|
407095 |
if (gst_poll_fd_can_write (l->fdset, &l->fd_w)) {
|
|
|
407095 |
if (!write_one (l))
|
|
|
407095 |
goto fail_and_cleanup;
|
|
|
407095 |
+ } else if (gst_poll_fd_has_closed (l->fdset, &l->fd_w)) {
|
|
|
407095 |
+ GST_LOG ("write fd %d closed", l->fd_w.fd);
|
|
|
407095 |
+ goto fail_and_cleanup;
|
|
|
407095 |
}
|
|
|
407095 |
}
|
|
|
407095 |
} while (l->tx_buf_read < l->tx_buf_write);
|
|
|
407095 |
--
|
|
|
407095 |
1.8.1.2
|
|
|
407095 |
|