[pulseaudio-discuss] [PATCH RFC 17/17] iochannel: Fix channel enable
Peter Meerwald
pmeerw at pmeerw.net
Fri Oct 24 14:21:41 PDT 2014
---
src/pulsecore/iochannel.c | 35 +++++++++++------------------------
1 file changed, 11 insertions(+), 24 deletions(-)
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 6b1fc7a..dd88208 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -82,35 +82,24 @@ static void enable_events(pa_iochannel *io) {
}
if (io->ifd == io->ofd && io->ifd >= 0) {
- pa_io_event_flags_t f = PA_IO_EVENT_NULL;
+ pa_io_event_flags_t f = PA_IO_EVENT_INPUT;
- if (!io->readable)
- f |= PA_IO_EVENT_INPUT;
if (!io->writable)
f |= PA_IO_EVENT_OUTPUT;
pa_assert(io->input_event == io->output_event);
- if (f != PA_IO_EVENT_NULL) {
- if (io->input_event)
- io->mainloop->io_enable(io->input_event, f);
- else
- io->input_event = io->output_event = io->mainloop->io_new(io->mainloop, io->ifd, f, callback, io);
- } else
- delete_events(io);
-
+ if (io->input_event)
+ io->mainloop->io_enable(io->input_event, f);
+ else
+ io->input_event = io->output_event = io->mainloop->io_new(io->mainloop, io->ifd, f, callback, io);
} else {
if (io->ifd >= 0) {
- if (!io->readable) {
- if (io->input_event)
- io->mainloop->io_enable(io->input_event, PA_IO_EVENT_INPUT);
- else
- io->input_event = io->mainloop->io_new(io->mainloop, io->ifd, PA_IO_EVENT_INPUT, callback, io);
- } else if (io->input_event) {
- io->mainloop->io_free(io->input_event);
- io->input_event = NULL;
- }
+ if (io->input_event)
+ io->mainloop->io_enable(io->input_event, PA_IO_EVENT_INPUT);
+ else
+ io->input_event = io->mainloop->io_new(io->mainloop, io->ifd, PA_IO_EVENT_INPUT, callback, io);
}
if (io->ofd >= 0) {
@@ -119,10 +108,8 @@ static void enable_events(pa_iochannel *io) {
io->mainloop->io_enable(io->output_event, PA_IO_EVENT_OUTPUT);
else
io->output_event = io->mainloop->io_new(io->mainloop, io->ofd, PA_IO_EVENT_OUTPUT, callback, io);
- } else if (io->output_event) {
- io->mainloop->io_free(io->output_event);
- io->output_event = NULL;
- }
+ } else if (io->output_event)
+ io->mainloop->io_enable(io->output_event, 0);
}
}
}
--
1.9.1
More information about the pulseaudio-discuss
mailing list