* some iochannel fixes

* introduce reference counting in ioline
* fix memory leak in socket-client.c
* fix double-free error in protocol-esound.c


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@293 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-11-18 20:50:44 +00:00
parent eef235d879
commit 8641af3c6d
11 changed files with 240 additions and 145 deletions

View file

@ -103,25 +103,22 @@ static void do_read(struct pa_pstream *p);
static void do_something(struct pa_pstream *p) {
assert(p);
if (p->dead)
return;
p->mainloop->defer_enable(p->defer_event, 0);
pa_pstream_ref(p);
if (!p->dead && pa_iochannel_is_hungup(p->io)) {
p->dead = 1;
if (p->die_callback)
p->die_callback(p, p->die_callback_userdata);
}
if (!p->dead && pa_iochannel_is_readable(p->io))
do_read(p);
if (!p->dead && pa_iochannel_is_writable(p->io))
do_write(p);
if (!p->dead && pa_iochannel_is_readable(p->io))
do_read(p);
/* In case the line was hungup, make sure to rerun this function
as soon as possible, until all data has been read. */
if (!p->dead && pa_iochannel_is_hungup(p->io))
p->mainloop->defer_enable(p->defer_event, 1);
pa_pstream_unref(p);
}